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; }
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; }
// this method is deprecated in 006 use getPerpendicular ofxVec2f ofxPoint2f::perpendicular( const ofxPoint2f& pnt ) const{ return getPerpendicular(pnt); }
/** * Normalized perpendicular. */ ofxVec3f ofxVec3f::perpendiculared( const ofxVec3f& vec ) const { return getPerpendicular(vec); }