Пример #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
/**
* Normalized perpendicular.
*/
ofxVec3f ofxVec3f::perpendiculared( const ofxVec3f& vec ) const {
    return getPerpendicular(vec);
}