Vector3d<T> Ellipsoid<T>::getPosition(const Angle<T> u, const Angle<T> v) const { assert(0.0 <= u.getDegree().get() && u.getDegree().get() <= 360.0); assert(-90.0 <= v.getDegree().get() && v.getDegree().get() <= 90.0); const T x = radii.getX() * u.getCos() * v.getCos(); const T y = radii.getY() * u.getSin() * v.getCos(); const T z = radii.getZ() * v.getSin(); Vector3d<T> vec(x, y, z); const auto rotation = orientation.toMatrix(); vec.rotate(rotation.transposed()); //const auto& invRotation = rotation.transposed(); return vec + center; }
Vector3d<T> Cone<T>::getPosition(const Angle<T> u, const Param<T> v) const { const auto x = radius * (1-v.get()) * u.getCos(); const auto y = v.get() * height - height*T{ 0.5 }; const auto z = radius * (1-v.get()) * u.getSin(); Vector3d<T> vec(x, y, z); const auto rotation = orientation.toMatrix(); vec.rotate(rotation.transposed()); return vec + center; }