这篇教程C++ GetRadius函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetRadius函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRadius函数的具体用法?C++ GetRadius怎么用?C++ GetRadius使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetRadius函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetRadiusvoid CCircle::AppendProperties(std::ostream & strm) const{ CSolidShape::AppendProperties(strm); strm << "/tPosition center = (" << m_positionCenter.x << ", " << m_positionCenter.y << ")" << std::endl << "/tRadius = " << GetRadius() << std::endl;}
开发者ID:7kia,项目名称:OOP,代码行数:7,
示例2: GetPositionbool RigidBody::SPHEREvsAABB(RigidBody* actor){ vec3 temp_length = m_position - actor->GetPosition(); float length = glm::length(temp_length); float intersection = m_radius + actor->GetWidth() - length; // First, compute the distance between the centers glm::vec3 SepAxis = actor->GetPosition() - GetPosition(); float Dist = glm::length(SepAxis); // then, find the unit vector that points from the box center to the sphere center glm::normalize(SepAxis); // divide each component of the unit vector by the maximum component, effectively "normalizing" the unit vector if (SepAxis.x >= SepAxis.y && SepAxis.x >= SepAxis.z) SepAxis /= SepAxis.x; else if (SepAxis.y >= SepAxis.x && SepAxis.y >= SepAxis.z) SepAxis /= SepAxis.y; else SepAxis /= SepAxis.z; // Now, find the effective radius of the box along the "normalized" unit vector pointing to the sphere SepAxis.x *= actor->GetWidth() / 2.0f; SepAxis.y *= actor->GetHeight() / 2.0f; SepAxis.z *= actor->GetLength() / 2.0f; float Dist2 = glm::length(SepAxis); // Finally, add the sphere radius to the box radius and compare to the distance if (Dist <= (GetRadius() + Dist2)) { vec3 collisionNormal = glm::normalize(temp_length); vec3 relativeVelocity = m_velocity - actor->GetVelocity(); vec3 collisionVector = collisionNormal *(glm::dot(relativeVelocity, collisionNormal)); vec3 forceVector = collisionVector * 1.0f / (1 / m_mass + 1 / actor->GetMass()); applyForceToActor(actor, 1 * forceVector); // the 1* should really be *2 //move our spheres out of collision vec3 seperationVector = collisionNormal * intersection * .50f; m_position += seperationVector; actor->m_position -= seperationVector; std::cout << "Colliding with: CUBE!" << " ID:" << m_id << "/n"; return true; } else return false;}
开发者ID:monarchshield,项目名称:PhysicsAssesment,代码行数:60,
示例3: GetRadiusconst SHAPE_LINE_CHAIN SHAPE_ARC::ConvertToPolyline( double aAccuracy ) const{ SHAPE_LINE_CHAIN rv; double r = GetRadius(); double sa = GetStartAngle(); auto c = GetCenter(); int n; if( r == 0.0 ) { n = 0; } else { n = GetArcToSegmentCount( r, From_User_Unit( MILLIMETRES, aAccuracy ), m_centralAngle ); } for( int i = 0; i <= n ; i++ ) { double a = sa + m_centralAngle * (double) i / (double) n; double x = c.x + r * cos( a * M_PI / 180.0 ); double y = c.y + r * sin( a * M_PI / 180.0 ); rv.Append( (int) x, (int) y ); } return rv;}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:28,
示例4: GetPositionbool Surfel::Contains ( const Vec3Df& iPoint) const { float distance = ( iPoint - GetPosition () ).getLength (); return ( distance <= GetRadius () );}
开发者ID:elfprincexu,项目名称:RayMini,代码行数:7,
示例5: AddRefvoid CprobeIGC::Terminate(void){ AddRef(); DataProbeTypeIGC* dataProbeType = (DataProbeTypeIGC*)(m_probeType->GetData()); if (dataProbeType->dtRipcord >= 0.0f) { GetMyMission()->GetIgcSite()->DestroyTeleportProbe(this); } if (m_projectileType) { m_projectileType->Release(); m_projectileType = NULL; } m_launcher = NULL; m_target = NULL; GetCluster()->GetClusterSite()->AddExplosion(GetPosition(), GetRadius(), c_etProbe); GetMyMission()->DeleteProbe(this); TmodelIGC<IprobeIGC>::Terminate(); if (m_probeType) { m_probeType->Release(); m_probeType = NULL; } Release();}
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:32,
示例6: GetRadiusvoid ImgMaskCreator::DrawLine( const std::vector<PointPair>& pairVect, const std::vector<Space>& position, PelGray8 lineVal){ static const double PIdiv180 = 3.1415926/180.0; if(m_img.IsNull()) return; m_position = position; m_boundLineVal = lineVal; m_img.Maximize(); size_t radius = GetRadius(); size_t size = pairVect.size(); for(size_t i=0; i<size; i++) { TPoint2D<long> point0 = pairVect[i].first; TPoint2D<long> point1 = pairVect[i].last; TPoint2D<long> diff = point1 - point0; if(8 * abs(diff.x()) < abs(diff.y()) || diff.Mag()<radius/3 ) { DrawLine(point0, point1); } else { DrawArc(point0, point1, radius); } }}
开发者ID:Strongc,项目名称:my001project,代码行数:32,
示例7: GetNextPointvoidGetNextPoint ( gsl_matrix *pic, gsl_matrix *raw, gsl_vector *v1, gint dx1, gint dy1, gint dx2, gint dy2, gint dx3, gint dy3, gint *x, gint *y ) { gsl_matrix_view view = gsl_matrix_submatrix ( raw, gsl_vector_get ( v1, 0 ) - 1, gsl_vector_get ( v1, 1 ) - 1, 3, 3 ); gsl_matrix_view view2 = gsl_matrix_submatrix ( pic, gsl_vector_get ( v1, 0 ) - 1, gsl_vector_get ( v1, 1 ) - 1, 3, 3 ); for ( int i=0; i<3; i++ ) { for ( int j=0; j<3; j++ ) { if ( gsl_matrix_get((gsl_matrix*)&view2,i,j) <= 5.0 || gsl_matrix_get((gsl_matrix*)&view2,i,j) >= 250 ) { gsl_matrix_set ( (gsl_matrix*)&view, i, j, 0 ); } else { gsl_matrix_set ( (gsl_matrix*)&view, i, j, gsl_matrix_get ( (gsl_matrix*)&view, i, j ) + GetRadius ( i-1, j-1 ) * weight + gsl_matrix_get ( (gsl_matrix*)&view2, i, j ) * huidu ); } } } gfloat x0 = gsl_vector_get ( v1, 0 ); gfloat y0 = gsl_vector_get ( v1, 1 ); gfloat f1 = gsl_matrix_get ( raw, x0+dx1, y0+dy1 ); gfloat f2 = gsl_matrix_get ( raw, x0+dx2, y0+dy2 ); gfloat f3 = gsl_matrix_get ( raw, x0+dx3, y0+dy3 ); gfloat f = f1; *x = x0 + dx1; *y = y0 + dy1; if ( f2 > f ) f = f2, *x = x0 + dx2, *y = y0 + dy2; if ( f3 > f ) f = f3, *x = x0 + dx3, *y = y0 + dy3;// if ( f1 > threshold && abs(f1 - f) < threshold ) *x = x0 + dx1, *y = y0 + dy1;}
开发者ID:laojing,项目名称:imagerecog,代码行数:34,
示例8: GetBoundingBox ////brief ///Evaluates the bounding box of the capsule inline void GetBoundingBox(hkvAlignedBBox &dest) { dest.m_vMin = m_vStartPosition; dest.m_vMax = m_vStartPosition; dest.expandToInclude(m_vStartPosition+m_vDirection*GetLength()); dest.addBoundary (hkvVec3 (GetRadius())); }
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:9,
示例9: getComponentRadiusUDWORD getComponentRadius(BASE_STATS *psComponent){ iIMDShape *ComponentIMD = nullptr; iIMDShape *MountIMD = nullptr; SDWORD compID; compID = StatIsComponent(psComponent); if (compID >= 0) { StatGetComponentIMD(psComponent, compID, &ComponentIMD, &MountIMD); if (ComponentIMD) { return GetRadius(ComponentIMD); } } /* VTOL bombs are only stats allowed to have NULL ComponentIMD */ if (StatIsComponent(psComponent) != COMP_WEAPON || (((WEAPON_STATS *)psComponent)->weaponSubClass != WSC_BOMB && ((WEAPON_STATS *)psComponent)->weaponSubClass != WSC_EMP)) { ASSERT(ComponentIMD, "No ComponentIMD!"); } return COMPONENT_RADIUS;}
开发者ID:perim,项目名称:warzone2100,代码行数:26,
示例10: GetStartRadialObservationZone::BoundaryAnnularSectorZone::GetBoundary() const{ Boundary boundary; const unsigned steps = 20; const Angle delta = Angle::FullCircle() / steps; const Angle start = GetStartRadial().AsBearing(); Angle end = GetEndRadial().AsBearing(); if (end <= start + Angle::FullCircle() / 512) end += Angle::FullCircle(); const GeoPoint inner_start = GeoVector(GetInnerRadius(), GetStartRadial()).EndPoint(GetReference()); const GeoPoint inner_end = GeoVector(GetInnerRadius(), GetEndRadial()).EndPoint(GetReference()); GeoVector inner_vector(GetInnerRadius(), start + delta); for (; inner_vector.bearing < end; inner_vector.bearing += delta) boundary.push_front(inner_vector.EndPoint(GetReference())); boundary.push_front(inner_end); boundary.push_front(inner_start); GeoVector vector(GetRadius(), start + delta); for (; vector.bearing < end; vector.bearing += delta) boundary.push_front(vector.EndPoint(GetReference())); boundary.push_front(GetSectorEnd()); boundary.push_front(GetSectorStart()); return boundary;}
开发者ID:alon,项目名称:xcsoar,代码行数:33,
示例11: Vcross// -----------------------------------------------------------------------------// Calculate kinematics quantities (slip angle, longitudinal slip, camber angle,// and toe-in angle using the current state of the associated wheel body.// -----------------------------------------------------------------------------void ChTire::CalculateKinematics(double time, const WheelState& state, const ChTerrain& terrain) { // Wheel normal (expressed in global frame) ChVector<> wheel_normal = state.rot.GetYaxis(); // Terrain normal at wheel location (expressed in global frame) ChVector<> Z_dir = terrain.GetNormal(state.pos.x(), state.pos.y()); // Longitudinal (heading) and lateral directions, in the terrain plane ChVector<> X_dir = Vcross(wheel_normal, Z_dir); X_dir.Normalize(); ChVector<> Y_dir = Vcross(Z_dir, X_dir); // Tire reference coordinate system ChMatrix33<> rot; rot.Set_A_axis(X_dir, Y_dir, Z_dir); ChCoordsys<> tire_csys(state.pos, rot.Get_A_quaternion()); // Express wheel linear velocity in tire frame ChVector<> V = tire_csys.TransformDirectionParentToLocal(state.lin_vel); // Express wheel normal in tire frame ChVector<> n = tire_csys.TransformDirectionParentToLocal(wheel_normal); // Slip angle double abs_Vx = std::abs(V.x()); double zero_Vx = 1e-4; m_slip_angle = (abs_Vx > zero_Vx) ? std::atan(V.y() / abs_Vx) : 0; // Longitudinal slip m_longitudinal_slip = (abs_Vx > zero_Vx) ? -(V.x() - state.omega * GetRadius()) / abs_Vx : 0; // Camber angle m_camber_angle = std::atan2(n.z(), n.y());}
开发者ID:armanpazouki,项目名称:chrono,代码行数:37,
示例12: fbool SectorZone::IsInSector(const GeoPoint &location) const{ GeoVector f(GetReference(), location); return f.distance <= GetRadius() && IsAngleInSector(f.bearing);}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:7,
示例13: GetCastervoid DynamicObject::Update(uint32 p_time){ // caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor Unit* caster = GetCaster(); if (!caster) { Delete(); return; } bool deleteThis = false; if (m_aliveDuration > int32(p_time)) m_aliveDuration -= p_time; else deleteThis = true; if (m_effIndex < 4) { if (m_updateTimer < p_time) { Oregon::DynamicObjectUpdater notifier(*this,caster); VisitNearbyObject(GetRadius(), notifier); m_updateTimer = 500; // is this official-like? }else m_updateTimer -= p_time; } if (deleteThis) { caster->RemoveDynObjectWithGUID(GetGUID()); Delete(); }}
开发者ID:Agustin1010,项目名称:Oregon-Core,代码行数:33,
示例14: GetRadiusboolCylinderZone::Equals(const ObservationZonePoint &other) const{ const CylinderZone &z = (const CylinderZone &)other; return ObservationZonePoint::Equals(other) && GetRadius() == z.GetRadius();}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:7,
示例15: IsCollidingbool CollisionSystem::IsColliding(std::shared_ptr<Entity> entity1, std::shared_ptr<Entity> entity2){ auto colliderComponent1 = std::static_pointer_cast<ColliderComponent>(Engine::GetInstance().GetSingleComponentOfClass(entity1, "ColliderComponent")); auto colliderComponent2 = std::static_pointer_cast<ColliderComponent>(Engine::GetInstance().GetSingleComponentOfClass(entity2, "ColliderComponent")); auto particleComponent1 = std::static_pointer_cast<ParticleComponent>(Engine::GetInstance().GetSingleComponentOfClass(entity1, "ParticleComponent")); auto particleComponent2 = std::static_pointer_cast<ParticleComponent>(Engine::GetInstance().GetSingleComponentOfClass(entity2, "ParticleComponent")); float radius1 = colliderComponent1->GetRadius(); float radius2 = colliderComponent2->GetRadius(); Vector position1 = particleComponent1->GetPosition(); Vector position2 = particleComponent2->GetPosition(); float distance = position1.CalculateDistance(position2); if (distance < (radius1 + radius2)) return true; return false;}
开发者ID:matheusportela,项目名称:Poiesis,代码行数:17,
示例16: GetCenterbool Collision2D::IsWithinRadius(const sf::Sprite& sprite1, const sf::Sprite& sprite2, const float radius1){ // Check for a collision const sf::Vector2f kfCenterSubtraction = GetCenter(sprite1) - GetCenter(sprite2); const float kfMagnitude = Maths2D::Magnitude(kfCenterSubtraction); const float kfRadiiSum = radius1 + GetRadius(sprite2); return kfMagnitude < kfRadiiSum;}
开发者ID:rzsavilla,项目名称:Monk,代码行数:8,
示例17: GetRadiusvoid meRingCut::GetNormal( double normal[3] ){ GetRadius(); for(int i=0; i<3; i++) { normal[i] = this->m_Normal[i]; }}
开发者ID:jakubsadura,项目名称:Swiezy,代码行数:8,
示例18: if/** /brief Does this bounding box intersect with another*/const bool CSpaghettiBoundsSphere::Intersects( CSpaghettiBounds *other, //!< The bounding box to test against std::vector<CCollision> &collision ){ if (other->GetType() == BoundsType::Box) { // Sphere on box const bool result = other->Intersects(this, collision); if (!result) return false; return true; } else if (other->GetType() == BoundsType::Sphere) { // Sphere on sphere CSpaghettiBoundsSphere *const otherSphere = static_cast<CSpaghettiBoundsSphere*>(other); const float distance = (m_position - otherSphere->GetPosition()).length(); const float radius = GetRadius() + otherSphere->GetRadius(); if (distance <= radius) { Ogre::Vector3 collisionNormal = otherSphere->GetPosition() - GetPosition(); collisionNormal.normalise(); Ogre::Vector3 collisionPoint =collisionNormal * GetRadius(); CCollision newCollision; newCollision.bodyOne = GetBody(); newCollision.bodyTwo = otherSphere->GetBody(); newCollision.collisionNormal = collisionNormal; newCollision.collisionPoint = GetPosition() + collisionPoint; newCollision.penetration = radius - distance; collision.push_back(newCollision); return true; } return false; } return false;}
开发者ID:SamOatesUniversity,项目名称:Year-3---Physics---Spaghetti,代码行数:48,
示例19: GetRadiusvoid Body::Draw(){ if(big){ graphics->ScaleImage(img, game->GetScaleFactor() * 1.2f); }else{ graphics->ScaleImage(img, game->GetScaleFactor()); } graphics->DrawImage(GetPosition(), img); graphics->DrawCircle(GetPosition(), GetRadius(), Color::Blue);}
开发者ID:maxon887,项目名称:Jim-the-Snake,代码行数:9,
示例20: fboolAnnularSectorZone::IsInSector(const GeoPoint &location) const{ GeoVector f(GetReference(), location); return (f.distance <= GetRadius()) && (f.distance >= inner_radius) && IsAngleInSector(f.bearing);}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:9,
示例21: GetNamestring CCone::GetInfo() const{ string info = GetName() + '/n' + "height = " + to_string(GetHeight()) + '/n' + "radius = " + to_string(GetRadius()) + '/n' + "value = " + to_string(GetVolume()) + '/n' + "mass = " + to_string(GetMass()); return info;}
开发者ID:licar,项目名称:Lab4,代码行数:9,
示例22: fboolAnnularSectorZone::IsInSector(const AircraftState &ref) const{ GeoVector f(GetReference(), ref.location); return (f.distance <= GetRadius()) && (f.distance >= inner_radius) && IsAngleInSector(f.bearing);}
开发者ID:alon,项目名称:xcsoar,代码行数:9,
示例23: StringCastvoid CollisionMesh::DrawDiagnostics(){ if(m_draw && m_geometry && m_engine->diagnostic()->AllowDiagnostics(Diagnostic::MESH)) { // Render world vertices const std::string id = StringCast(this); const float vertexRadius = 0.1f; const auto& vertices = GetVertices(); for(unsigned int i = 0; i < vertices.size(); ++i) { m_engine->diagnostic()->UpdateSphere(Diagnostic::MESH, "0" + StringCast(i) + id, Diagnostic::RED, vertices[i], vertexRadius); } // Render face normals m_geometry->UpdateDiagnostics(*m_engine->diagnostic(), m_world.GetMatrix()); // Render OABB for diagnostic mesh auto getPointColor = [=](int index) -> Diagnostic::Colour { return index == MINBOUND || index == MAXBOUND ? Diagnostic::BLUE : Diagnostic::MAGENTA; }; const float radius = 0.2f; std::string corner; for(unsigned int i = 0; i < CORNERS/2; ++i) { corner = StringCast(i); m_engine->diagnostic()->UpdateSphere(Diagnostic::MESH, "CornerA" + corner + id, getPointColor(i), m_oabb[i], radius); m_engine->diagnostic()->UpdateSphere(Diagnostic::MESH, "CornerB" + corner + id, getPointColor(i+4), m_oabb[i+4], radius); m_engine->diagnostic()->UpdateLine(Diagnostic::MESH, "LineA" + corner + id, Diagnostic::MAGENTA, m_oabb[i], m_oabb[i+1 >= 4 ? 0 : i+1]); m_engine->diagnostic()->UpdateLine(Diagnostic::MESH, "LineB" + corner + id, Diagnostic::MAGENTA, m_oabb[i+4], m_oabb[i+5 >= CORNERS ? 4 : i+5]); m_engine->diagnostic()->UpdateLine(Diagnostic::MESH, "LineC" + corner + id, Diagnostic::MAGENTA, m_oabb[i], m_oabb[i+4]); } // Render radius of diagnostic mesh in wireframe m_engine->diagnostic()->UpdateSphere(Diagnostic::MESH, "Radius" + id, Diagnostic::WHITE, GetPosition(), GetRadius()); }}
开发者ID:huaminglee,项目名称:cloth-simulator,代码行数:56,
示例24: GetRadiusstd::string CCylinder::GetInfo() const{ std::ostringstream info; info << "Cylinder with base radius " << GetRadius(); info << ", height " << GetHeight(); info << " and density " << GetDensity(); return info.str();}
开发者ID:EfremovCompany,项目名称:lab4,代码行数:10,
示例25: RecomputeLocalTerrainVelocityvoid FGPropagate::UpdateVehicleState(void){ RecomputeLocalTerrainVelocity(); VehicleRadius = GetRadius(); VState.vInertialPosition = Tec2i * VState.vLocation; UpdateLocationMatrices(); UpdateBodyMatrices(); vVel = Tb2l * VState.vUVW; VState.qAttitudeLocal = Tl2b.GetQuaternion();}
开发者ID:ToninoTarsi,项目名称:jsbsim,代码行数:10,
示例26: GetRadiusstd::string CCone::GetInformation() const{ std::ostringstream info; info << "Cone with base radius " << GetRadius(); info << ", height " << GetHeight(); info << " and density " << GetDensity(); return info.str();}
开发者ID:psmax,项目名称:lab4,代码行数:10,
示例27: GetLatitudedouble FGLocation::GetDistanceTo(double target_longitude, double target_latitude) const{ double delta_lat_rad = target_latitude - GetLatitude(); double delta_lon_rad = target_longitude - GetLongitude(); double distance_a = pow(sin(0.5*delta_lat_rad), 2.0) + (GetCosLatitude() * cos(target_latitude) * (pow(sin(0.5*delta_lon_rad), 2.0))); return 2.0 * GetRadius() * atan2(sqrt(distance_a), sqrt(1.0 - distance_a));}
开发者ID:AEgisTG,项目名称:jsbsim,代码行数:12,
示例28: GetRadiusvoid cStructGenWormNestCaves::cCaveSystem::GenerateTunnelsFromPoint( int a_OriginX, int a_OriginY, int a_OriginZ, cNoise & a_Noise, int a_NumSegments){ int DoubleSize = m_Size * 2; int Radius = GetRadius(a_Noise, a_OriginX + a_OriginY, a_OriginY + a_OriginZ, a_OriginZ + a_OriginX); for (int i = a_NumSegments - 1; i >= 0; --i) { int EndX = a_OriginX + (((a_Noise.IntNoise3DInt(a_OriginX, a_OriginY, a_OriginZ + 11 * a_NumSegments) / 7) % DoubleSize) - m_Size) / 2; int EndY = a_OriginY + (((a_Noise.IntNoise3DInt(a_OriginY, 13 * a_NumSegments, a_OriginZ + a_OriginX) / 7) % DoubleSize) - m_Size) / 4; int EndZ = a_OriginZ + (((a_Noise.IntNoise3DInt(a_OriginZ + 17 * a_NumSegments, a_OriginX, a_OriginY) / 7) % DoubleSize) - m_Size) / 2; int EndR = GetRadius(a_Noise, a_OriginX + 7 * i, a_OriginY + 11 * i, a_OriginZ + a_OriginX); m_Tunnels.push_back(new cCaveTunnel(a_OriginX, a_OriginY, a_OriginZ, Radius, EndX, EndY, EndZ, EndR, a_Noise)); GenerateTunnelsFromPoint(EndX, EndY, EndZ, a_Noise, i); a_OriginX = EndX; a_OriginY = EndY; a_OriginZ = EndZ; Radius = EndR; } // for i - a_NumSegments}
开发者ID:ThuGie,项目名称:MCServer,代码行数:21,
注:本文中的GetRadius函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetRand函数代码示例 C++ GetRValue函数代码示例 |