// Constructor from just gravity magnitude; use negative of System "up" // direction as the down direction here. GravityImpl(const SimbodyMatterSubsystem& matter, Real magnitude, Real zeroHeight) : matter(matter) { // Invoke the general constructor using system up direction. new (this) GravityImpl(matter, -matter.getSystem().getUpDirection(), magnitude, zeroHeight); }
// Constructor from a gravity vector, which might have zero magnitude. // In that case we'll negate the default up direction in the System as the // default direction. That would only be noticeable if the magnitude were // later increased without giving a new direction. GravityImpl(const SimbodyMatterSubsystem& matter, const Vec3& gravityVec, Real zeroHeight) : matter(matter) { // Invoke the general constructor using system up direction. new (this) GravityImpl(matter, -matter.getSystem().getUpDirection(), gravityVec.norm(), zeroHeight); if (defMagnitude > 0) defDirection=UnitVec3(gravityVec/defMagnitude,true); }