예제 #1
0
float Line2d::getDistanceTo(const Vector2d &point, Vector2d *intersection) const {
	float dist = fabsf(_a * point.getX() + _b * point.getY() + _c) / sqrt(_a * _a + _b * _b);

	if (intersection) {
		intersectsLine(getPerpendicular(point), intersection);
	}
	return dist;
}
예제 #2
0
void Planet::calculateNetAcceleration(QuadTreeNodeData * mOtherPlanet)
{
	atlas::math::Vector r = (mPosition - mOtherPlanet->centerOfMass);
	atlas::math::Vector mNormalRadius = getNormal(r);
	atlas::math::Vector mPerpendicular = getPerpendicular(mNormalRadius);
	float rModulus = getModulus(r);

	if (rModulus <= 0.05f)
		return;

	thetadotdot -= (2.0f * (mAngVelocity * getModulus(mRadialVelocity)) / rModulus);
	rdotdot += mAngVelocity * mAngVelocity * rModulus - ((G * mOtherPlanet->totalMass) / (rModulus * rModulus));
	
	mRadialResultant += mNormalRadius;
	mTangenResultant += mPerpendicular * rModulus;

}
예제 #3
0
// this method is deprecated in 006 use getPerpendicular
ofxVec2f ofxPoint2f::perpendicular( const ofxPoint2f& pnt ) const{
	return getPerpendicular(pnt);
}
예제 #4
0
파일: ofxVec3f.cpp 프로젝트: hjss/ofx-dev
/**
* Normalized perpendicular.
*/
ofxVec3f ofxVec3f::perpendiculared( const ofxVec3f& vec ) const {
    return getPerpendicular(vec);
}