本文整理汇总了C++中Radius函数的典型用法代码示例。如果您正苦于以下问题:C++ Radius函数的具体用法?C++ Radius怎么用?C++ Radius使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Radius函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void IFXVector4::IncorporateSphere(const IFXVector4 * pBound)
{
//* In addition to guarding against NULL incomming bounds, we need to
//* check that the incomming bound is valid(radius != -1).
/* IFXVector4 left, right;
right.set(pBound->X(),pBound->Y(),pBound->Z(),pBound->Radius());
left.set(X(),Y(),Z(),Radius());
left.Incorporate(&right);
m_value[0] = left.X();
m_value[1] = left.Y();
m_value[2] = left.Z();
m_value[3] = left.Radius();
*/
if(pBound->Radius() >= 0.0)
{
//* If THIS bound is uninitialized, then simply assimilate the values
//* from the incomming sphere's bound.
if(Radius()<0.0f)
{
*this=*pBound;
}
else
{
//* If initialized, determine the correct bounding sphere.
//* First determine the vector between the spheres centers.
IFXVector4 vectorBetweenCenters;
vectorBetweenCenters.Subtract(*this,*pBound);
//* distance between the spheres' centers
F32 distanceBetweenCenters=vectorBetweenCenters.CalcMagnitude3();
//* If this bound does not already encompass the incoming sphere.
if(Radius() < pBound->Radius()+distanceBetweenCenters)
{
//* If the incoming sphere encompasses this sphere, then
//* simply assimilate the values from the incomming sphere's
//* bound.
if(pBound->Radius() > Radius()+distanceBetweenCenters)
{
*this=*pBound;
}
//* Guard against divide by zero.
else if(distanceBetweenCenters != 0.0f)
{
//* A new sphere must be calculated.
F32 d=1.0f/distanceBetweenCenters;
d*=Radius()-pBound->Radius();
vectorBetweenCenters.Scale3(0.5f+0.5f*d);
this->Add(*pBound,vectorBetweenCenters);
m_value[3]=0.5f*
(Radius()+pBound->Radius()+distanceBetweenCenters);
}
}
}
}
}
示例2: trace
bool CSnork::trace_geometry(const Fvector &d, float &range)
{
Fvector dir;
float h, p;
Fvector Pl,Pc,Pr;
Fvector center;
Center (center);
range = trace (d);
if (range > TRACE_RANGE) return false;
float angle = asin(1.f / range);
// trace center ray
dir = d;
dir.getHP (h,p);
p += angle;
dir.setHP (h,p);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pc.mad (center, dir, range);
// trace left ray
Fvector temp_p;
temp_p.mad (Pc, XFORM().i, Radius() / 2);
dir.sub (temp_p, center);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pl.mad (center, dir, range);
// trace right ray
Fvector inv = XFORM().i;
inv.invert ();
temp_p.mad (Pc, inv, Radius() / 2);
dir.sub (temp_p, center);
dir.normalize_safe ();
range = trace (dir);
if (range > TRACE_RANGE) return false;
Pr.mad (center, dir, range);
float h1,p1,h2,p2;
Fvector().sub(Pl, Pc).getHP(h1,p1);
Fvector().sub(Pc, Pr).getHP(h2,p2);
return (fsimilar(h1,h2,0.1f) && fsimilar(p1,p2,0.1f));
}
示例3: Cas2Shuttle
integer Cas2Shuttle(CASblock & buffer, ShuttlePar & block){
/* Reading M1950 coordinates and velocities from CAs */
const int foot_cm=30.48;
double Coo_M1950[3], Vel_M1950[3], q[4], Greenw_Phi, Vel_angle;
polar Geo,Solar;
Euler Euler_LVLH;
Coo_M1950[0]=CASvalue(buffer,(4490),8) * foot_cm;
Coo_M1950[1]=CASvalue(buffer,(4508),8) * foot_cm;
Coo_M1950[2]=CASvalue(buffer,(4526),8) * foot_cm;
Vel_M1950[0]=CASvalue(buffer,(4687),8) * foot_cm;
Vel_M1950[1]=CASvalue(buffer,(4701),8) * foot_cm;
Vel_M1950[2]=CASvalue(buffer,(4715),8) * foot_cm;
q[0]=CASvalue(buffer,(3291),8);
q[1]=CASvalue(buffer,(3305),8);
q[2]=CASvalue(buffer,(3319),8);
q[3]=CASvalue(buffer,(3333),8);
double times= CAStime(buffer,10);
time_t utime = time_t(times+0.5) + Year1998;
// check record
if((Radius(Coo_M1950)<=.1) || (Radius(Vel_M1950)<=.1) || (times<=0))return 0;
// convert here
Coordinates(Coo_M1950,Vel_M1950,q,utime,&Geo,&Vel_angle,&Euler_LVLH,&Solar,&Greenw_Phi);
if(!td2f(Geo.Teta))return -1;
if(!td2f(Geo.Phi))return -1;
if(!td2f(Geo.R))return -1;
if(!td2f(Greenw_Phi))return -1;
if(!td2f(Euler_LVLH.Yaw))return -1;
if(!td2f(Euler_LVLH.Pitch))return -1;
if(!td2f(Euler_LVLH.Yaw))return -1;
if(!td2f(Vel_angle))return -1;
if(!td2f(Solar.R))return -1;
if(!td2f(Solar.Phi))return -1;
if(!td2f(Solar.Teta))return -1;
block.StationTheta=d2f(Geo.Teta);
block.StationPhi=d2f(Geo.Phi);
block.StationR=d2f(Geo.R);
block.GrMedPhi=d2f(Greenw_Phi);
block.StationYaw=d2f(Euler_LVLH.Yaw);
block.StationPitch=d2f(Euler_LVLH.Pitch);
block.StationRoll=d2f( Euler_LVLH.Roll);
block.StationSpeed=d2f( Vel_angle);
block.SunR=d2f(Solar.R);
block.SunPhi=d2f(Solar.Phi);
block.SunTheta=d2f(Solar.Teta);
//cout <<" "<<ClockTune(utime)<<" "<<ctime(&utime)<<endl;
block.Time=utime-ClockTune(utime);
}
示例4: Std_CheckString
bool Cylinder::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
{
std::string strType = Std_CheckString(strDataType);
if(RigidBody::SetData(strType, strValue, false))
return true;
if(strType == "RADIUS")
{
Radius((float) atof(strValue.c_str()));
return true;
}
if(strType == "HEIGHT")
{
Height((float) atof(strValue.c_str()));
return true;
}
if(strType == "SIDES")
{
Sides(atoi(strValue.c_str()));
return true;
}
//If it was not one of those above then we have a problem.
if(bThrowError)
THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
return false;
}
示例5: SeedRing
void Smooth::SeedRing() {
for (int x=0;x<sizex;x++) {
for (int y=0;y<sizey;y++) {
(*field)[x][y]=Ring(Radius(0,0,x,y));
}
}
}
示例6: XFORM
void CMosquitoBald::Affect(SZoneObjectInfo* O)
{
CPhysicsShellHolder *pGameObject = smart_cast<CPhysicsShellHolder*>(O->object);
if(!pGameObject) return;
if(O->zone_ignore) return;
Fvector P;
XFORM().transform_tiny(P,CFORM()->getSphere().P);
Fvector hit_dir;
hit_dir.set( ::Random.randF(-.5f,.5f),
::Random.randF(.0f,1.f),
::Random.randF(-.5f,.5f));
hit_dir.normalize();
Fvector position_in_bone_space;
VERIFY(!pGameObject->getDestroy());
float dist = pGameObject->Position().distance_to(P) - pGameObject->Radius();
float power = Power(dist>0.f?dist:0.f, Radius());
float impulse = m_fHitImpulseScale*power*pGameObject->GetMass();
if(power > 0.01f)
{
position_in_bone_space.set(0.f,0.f,0.f);
CreateHit(pGameObject->ID(),ID(),hit_dir,power,0,position_in_bone_space,impulse,m_eHitTypeBlowout);
PlayHitParticles(pGameObject);
}
}
示例7: GetCoeff
void CircleSeg<D> :: GetCoeff (Vector & coeff) const
{
coeff[0] = coeff[1] = 1.0;
coeff[2] = 0.0;
coeff[3] = -2.0 * pm[0];
coeff[4] = -2.0 * pm[1];
coeff[5] = sqr(pm[0]) + sqr(pm[1]) - sqr(Radius());
}
示例8: f22
double f22(double k,void * params) /* No integral before the deltaM*/
{
double alpha = *(double *) params;
double f1 = pow(k,2.0) / (2 * pow(M_PI,2.0));
double f2 = Pk( k) * pow(Windowfunc( k,Radius(alpha)),2.0) ;
double f = f1 * f2;
return sqrt(f);
}
示例9: FillingRing
filling Smooth::FillingRing(int x, int y) const {
double total=0.0;
for (int x1=0;x1<sizex;x1++) {
for (int y1=0;y1<sizey;y1++) {
total+=(*field)[x1][y1]*Ring(Radius(x,y,x1,y1));
}
};
return total/normalisation_ring;
}
示例10: NormalisationRing
double Smooth::NormalisationRing() const {
double total=0.0;
for (int x=0;x<sizex;x++) {
for (int y=0;y<sizey;y++) {
total+=Ring(Radius(0,0,x,y));
}
};
return total;
}
示例11: Radius
bool
Graphic::CheckVisibility(Projector& projector)
{
if (projector.IsVisible( Location(), Radius()) &&
projector.ApparentRadius(Location(), Radius()) > 1) {
visible = true;
}
else {
visible = false;
screen_rect.x = 2000;
screen_rect.y = 2000;
screen_rect.w = 0;
screen_rect.h = 0;
}
return visible;
}
示例12: GetPoint
Point<D> CircleSeg<D> :: GetPoint (double t) const
{
if (t >= 1.0) { return p3; }
double phi = StartAngle() + t*(EndAngle()-StartAngle());
Vec<D> tmp(cos(phi),sin(phi));
return pm + Radius()*tmp;
}
示例13: RelativePower
void CBaseGraviZone::AffectPullAlife(CEntityAlive* EA,const Fvector& throw_in_dir,float dist)
{
float rel_power = RelativePower(dist, Radius());
float throw_power = m_fThrowInImpulseAlive*rel_power*rel_power*rel_power*rel_power*rel_power;
Fvector vel;
vel.set(throw_in_dir);
vel.mul(throw_power);
EA->character_physics_support()->movement()->AddControlVel(vel);
}
示例14: Radius
void Cylinder::Load(CStdXml &oXml)
{
RigidBody::Load(oXml);
oXml.IntoElem(); //Into RigidBody Element
Radius(oXml.GetChildFloat("Radius", m_fltRadius));
Height(oXml.GetChildFloat("Height"), m_fltHeight);
Sides(oXml.GetChildInt("Sides", m_iSides));
oXml.OutOfElem(); //OutOf RigidBody Element
}
示例15: Longitude
// ==============================================================================================================================================
//
double Orbit::IntersectionInterpolate(Orbit *tgt,double start,double end,bool dir)
{
int i;
bool ok=false;
double dif;
double gamma,sector,aa,da,db,first=0;
VECTOR3 v;
gamma=start;
sector=end;
if (dir) sector=-sector;
sector/=2;
v=tgt->Position(gamma);
Longitude(v,&db,NULL,&aa);
da=Radius(aa);
first=da-db;
gamma+=sector;
for (i=0;i<30;i++) {
gamma=limit(gamma);
v=tgt->Position(gamma);
Longitude(v,&db,NULL,&aa);
da=Radius(aa);
dif=da-db;
if ((first*dif)<0) sector=-sector, ok=true;
first=dif;
sector/=2;
gamma+=sector;
}
if (!ok) return -1.0;
return(tgt->Translate(this,limit(gamma)));
}