예제 #1
0
void GetNearestSpawnPosition( const Vector3f &vIn, Vector3f &vOut, Angle3d &aOut )
{
	std::vector<CVehicleRespawnPosition*> &poss = singletons::g_pWorld->getRespawnPositions();
	if( poss.empty() )
		return;

	UINT index = 0;
	float mindistsq = VectorLengthSq( poss[0]->GetOrigin() - vIn );

	for( UINT i = 1; i < poss.size(); i++ )
	{
		float length = VectorLengthSq( poss[i]->GetOrigin() - vIn );
		if( length < mindistsq )
		{
			mindistsq = length;
			index = i;
		}
	}

	vOut = poss[index]->GetOrigin();
	aOut = poss[index]->GetAngle();
}
예제 #2
0
파일: csg4.c 프로젝트: AidHamza/eviltoys
void
UpdateFaceSphere(face_t *in)
{
    int i;
    vec3_t radius;
    vec_t lensq;

    MidpointWinding(&in->w, in->origin);
    in->radius = 0;
    for (i = 0; i < in->w.numpoints; i++) {
	VectorSubtract(in->w.points[i], in->origin, radius);
	lensq = VectorLengthSq(radius);
	if (lensq > in->radius)
	    in->radius = lensq;
    }
    in->radius = sqrt(in->radius);
}
예제 #3
0
float Lapidem_Math::VectorLength( TVECTOR _v )
{  return sqrtf( VectorLengthSq( _v ) ); }
예제 #4
0
파일: mathlib.c 프로젝트: AidHamza/eviltoys
vec_t
VectorLength(const vec3_t v)
{
    return sqrt(VectorLengthSq(v));
}