Skip to main content

Primitives

The Primitive plugin provides essential functionality to create, load, save, and manage a variety of geometric primitives. It supports configurable options such as tessellation levels, smoothing angles, and texture coordinate generation, allowing flexible control over mesh detail and appearance. Generated meshes can be stored in MeshGeometry or ObjectMesh instances for use in rendering and simulation pipelines.

  • PrimitiveBox: Creates a standard box or cuboid mesh with adjustable dimensions and subdivision steps.
  • PrimitiveSphere: Creates a UV-mapped sphere mesh with configurable radius and tessellation.
  • PrimitiveIcoSphere: Creates a geodesic sphere based on subdivided icosahedron geometry for more uniform triangle distribution.
  • PrimitiveTorus: Creates a donut-shaped mesh defined by major and minor radii, with control over tessellation and tiling.
  • PrimitiveTorusKnot: Creates a complex torus knot shape using parametric equations, customizable by radius, tile, and knot parameters.
  • PrimitiveCapsule: Creates a capsule (cylinder capped with hemispheres) useful for character collision shapes or rounded objects.
  • PrimitiveCylinder: Creates a cylindrical mesh with adjustable height, radii, and tessellation along height and circumference.
  • PrimitiveOctahedron: Creates an octahedron mesh composed of 8 triangular faces.
  • PrimitiveIcosahedron: Creates an icosahedron mesh with 20 triangular faces.
  • PrimitiveDodecahedron: Creates a dodecahedron mesh composed of 12 pentagonal faces.
info

This plugin is integrated into Tellusim Explorer.

#include <objects/primitives/include/TellusimPrimitives.h>

Example

// Create an icosphere
PrimitiveIcoSphere icosphere_primitive;
icosphere_primitive.setRadius(4.0f);
icosphere_primitive.setSteps(4);

// Create torus knot (2,3)
PrimitiveTorusKnot torusknot23_primitive;
torusknot23_primitive.setRadius(Vector3f(3.5f, 2.0f, 1.2f));
torusknot23_primitive.setSteps(Vector2u(256, 32));
torusknot23_primitive.setTile(Vector2f(48.0f, 3.0f));
torusknot23_primitive.setTorus(Vector2u(2, 3));

// Create torus knot (9,8)
PrimitiveTorusKnot torusknot98_primitive;
torusknot98_primitive.setRadius(Vector3f(0.0f, 5.0f, 0.3f));
torusknot98_primitive.setSteps(Vector2u(1024, 16));
torusknot98_primitive.setTile(Vector2f(96.0f, 3.0f));
torusknot98_primitive.setTorus(Vector2u(9, 8));