Spheres


Visualize supports a sphere primitive. It is tessellated at draw time which can greatly reduce the memory footprint of your application if spheres are widely used. It is inserted via a center point, radius, and vertical-horizontal vectors. The two vectors could be left unspecified, but are provided to more easily allow application of a texture. A sphere that is tessellated using vertical and horizontal vectors has 'poles' and thus a texture can be applied by wrapping it around the sphere as you would around a cylinder. A sample call is as follows:

HPS::SphereKit sphereKit;
sphereKit.SetCenter(Point(0, 0, 0));
sphereKit.SetRadius(0.5f);
sphereKit.SetBasis(Vector(0.25, 0.25, 1), Vector(1, 0, 0)); // basis includes 'vertical' and
// 'horizontal' vectors as params
mySegmentKey.InsertSphere(sphereKit);
HPS.SphereKit sphereKit = new HPS.SphereKit();
sphereKit.SetCenter(new HPS.Point(0, 0, 0));
sphereKit.SetRadius(0.5f);
sphereKit.SetBasis(new HPS.Vector(0, 1, 0), new HPS.Vector(1, 0, 0)); // basis includes 'axis'
// and 'up' vectors as params
mySegmentKey.InsertSphere(sphereKit);



A basic sphere

Sphere tessellation can also be controlled with the segment's HPS::SphereAttributeControl. The tessellation setting controls the number of faces around the equator of the sphere.

mySegmentKey.GetSphereAttributeControl().SetTessellation(50);



A sphere with a high tesselation value

Notes on sphere subentities

Spheres, like cylinders, are dynamically constructed Visualize primitives. One result of this is that user interaction among subentites is limited. For instance, setting attributes or materials on individual faces, lines, or vertices is not supported nor is altering their position. Cylinder and sphere primitives cannot be textured.