Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
int main()
{
	using PB_ANGLE::Angle;
	Angle object;
    
	double angle;
	char choice;

	do
	{
		system("cls");
		cout << "Please enter an angle in radians: ";
		cin  >> angle;
		cout << "angle: " << angle << " radians " << "<" << object.angleInDegrees(angle) << " degrees>" << endl;
		cout << "sine: " << object.getSin(angle) << endl;
		cout << "tangent: " << object.getTan(angle) << endl;
		cout << "cosine: " << object.Cosine(angle) << endl;
		cout << "cosine <from cmath>: " << cos(angle) << "\n\n";
		cout << "Would you like to enter another angle (Y/N)?" << endl;
		cin  >> choice;

	} while (toupper(choice) == 'Y');

	return EXIT_SUCCESS;
}
Exemplo n.º 3
0
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;
}