Add Geometries
This commit is contained in:
@@ -92,6 +92,36 @@ int main()
|
||||
|
||||
|
||||
|
||||
// CYLINDRICAL GEOMETRY TESTING
|
||||
{
|
||||
CylindricalGeometry cyl;
|
||||
Vector3f cyl_pt(5.0f, M_PI_2, 3.0f);
|
||||
Vector3f lin = cyl.ToLinear(cyl_pt);
|
||||
TEST0( Vector4f0(lin.homogeneous() - HPoint3f(0.0f, 5.0f, 3.0f)) );
|
||||
Vector3f recovered = cyl.FromLinear(lin);
|
||||
TEST0( Vector4f0(recovered.homogeneous() - cyl_pt.homogeneous()) );
|
||||
}
|
||||
|
||||
// SPHERICAL GEOMETRY TESTING
|
||||
{
|
||||
SphericalGeometry sph;
|
||||
Vector3f sph_pt(5.0f, M_PI_2, M_PI);
|
||||
Vector3f lin = sph.ToLinear(sph_pt);
|
||||
TEST0( Vector4f0(lin.homogeneous() - HPoint3f(-5.0f, 0.0f, 0.0f)) );
|
||||
Vector3f recovered = sph.FromLinear(Vector3f(-5.0f, 0.0f, 0.0f));
|
||||
TEST0( Vector4f0(recovered.homogeneous() - sph_pt.homogeneous()) );
|
||||
}
|
||||
|
||||
// TOROIDAL GEOMETRY TESTING
|
||||
{
|
||||
ToroidalGeometry tor(10.0f);
|
||||
Vector3f tor_pt(1.0f, M_PI_2, M_PI);
|
||||
Vector3f lin = tor.ToLinear(tor_pt);
|
||||
TEST0( Vector4f0(lin.homogeneous() - HPoint3f(-10.0f, 0.0f, 1.0f)) );
|
||||
Vector3f recovered = tor.FromLinear(Vector3f(-10.0f, 0.0f, 1.0f));
|
||||
TEST0( Vector4f0(recovered.homogeneous() - tor_pt.homogeneous()) );
|
||||
}
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user