3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
coat::torus Class Reference

The torus. More...

#include <CorePrimAPI.h>

Inheritance diagram for coat::torus:
coat::box coat::prim

Public Member Functions

 torus ()
 constructs a new torus object.
 
 torus (const float &ringRadius, const float &crossSectionRadius)
 constructs a new torus object.
 
 torus (const vec3 &pos, const float &ringRadius, const float &crossSectionRadius)
 constructs a new torus object.
 
torus & slices (const int &_slices)
 set the number of slices in the mesh.
 
int slices () const
 get the number of slices in the mesh.
 
torus & rings (const int &_rings)
 set the number of rings in the mesh.
 
int rings () const
 get the number of rings in the mesh.
 
torus & radius (const float &r)
 set the ring radius.
 
float radius () const
 get the ring radius.
 
torus & section_radius (const float &section_r)
 set the cross section radius.
 
float section_radius () const
 get the cross section radius.
 
torus & diameter (const float &d)
 set the ring diameter.
 
float diameter () const
 get the ring diameter.
 
torus & section_diameter (const float &section_d)
 set the cross section diameter.
 
float section_diameter () const
 get the cross section diameter.
 
torus & sector_on (const bool &_switch)
 set the flag to create a portion of torus.
 
bool sector_on () const
 get the flag of creating a portion of torus. Default = false.
 
torus & slices_angle (const float &angle)
 When sector is on, specifies the angle for torus slices. Default = 360 degrees.
 
float slices_angle () const
 get the angle for torus slices
 
torus & rings_angle (const float &angle)
 When sector is on, specifies the angle for torus rings. Default = 360 degrees.
 
float rings_angle () const
 get the angle for torus rings
 
- Public Member Functions inherited from coat::box
 box ()
 constructs a new box object.
 
 box (float sizeX, float sizeY, float sizeZ)
 constructs a new box object.
 
 box (const vec3 &size)
 constructs a new box object.
 
 box (const vec3 &pos, const vec3 &size)
 constructs a new box object.
 
 box (const vec3 &pos, const vec3 &size, float fillet)
 constructs a new box object.
 
box & axis (const vec3 &directionX)
 set the x-direction
 
box & axis (const vec3 &directionX, const vec3 &directionY)
 set the x and y direction
 
box & axis (const vec3 &directionX, const vec3 &directionY, const vec3 &directionZ)
 set the x, y and z direction
 
box & reset_axis ()
 reset the x, y and z direction
 
vec3 axis_x ()
 get the x-axis
 
vec3 axis_y ()
 get the y-axis
 
vec3 axis_z ()
 get the z-axis
 
box & divide (int nx, int ny, int nz)
 set the number deviding
 
box & size (const vec3 &_size)
 set the box size
 
box & size (float x, float y, float z)
 set the box size
 
vec3 size () const
 get the box size.
 
virtual float fillet_relative ()
 calculates a fillet relative value (0..1).
 
- Public Member Functions inherited from coat::prim
 prim ()
 constructs a new prim object.
 
str class_name ()
 get the primitive class name.
 
prim & name (const char *s)
 set the primitive object name.
 
str name () const
 get the primitive object name.
 
void add (Volume &v)
 add the prim into scene
 
void subtract (Volume &v)
 subtract the prim from scene
 
void intersect (Volume &v)
 intersect the prim into scene
 
void merge (Volume &v, const BoolOpType op)
 merge the prim into scene
 
Mesh mesh ()
 get the mesh prim
 
prim & color (DWORD CL)
 assign the color to the primitive (in voxels)
 
prim & color (float r, float g, float b, float a)
 assign the color to the primitive (in voxels)
 
prim & color (float r, float g, float b)
 assign the color to the primitive (in voxels)
 
prim & color (const char *colorid)
 assign the color to the primitive (in voxels)
 
prim & gloss (float value)
 assign the gloss for the voxel primitive, it will work only if the color already assigned
 
prim & roughness (float value)
 assign the roughness for the voxel primitive, it will work only if the color already assigned
 
prim & metal (float value)
 the metalliclty value for the voxel primitive, it will work only if the color already assigned
 
prim & opacity (float value)
 assign the opacity of the color over the voxel primitive. The color should be assigned before you assign the opacity, for example p.color("red").opacity(0.5)
 
prim & details (const float det_level)
 set the detail level
 
float details ()
 get the detail level
 
prim & transform (const mat4 &t)
 set the transform matrix
 
mat4 transform () const
 get the transform matrix
 
prim & scale (float scale)
 set the scale
 
prim & scale (const vec3 &v)
 set the scale
 
vec3 scale () const
 get the scale
 
prim & translate (const vec3 &_pos)
 Set the primitive translation.
 
vec3 translate () const
 get the primitive translation
 
prim & translate (float x, float y, float z)
 Set the primitive translation.
 
prim & x (float x)
 shift the primitive along the x - axis
 
prim & y (float y)
 shift the primitive along the y - axis
 
prim & z (float z)
 shift the primitive along the z - axis
 
prim & auto_divide (float average_div)
 set the auto devide
 
prim & step_divide (float step)
 set the step devide
 
prim & fillet (float radius)
 set the fillet
 
template<typename T >
T & Obj ()
 Get the primitive object reference.
 
template<typename T >
bool isAs ()
 Check the prim's type.
 

Protected Member Functions

virtual cMeshContainer * create_mesh ()
 creates a mesh container for the torus.
 
- Protected Member Functions inherited from coat::box
void init ()
 initialize the default parameters
 
- Protected Member Functions inherited from coat::prim
template<class T >
T & to_cast_this ()
 cast this prim to the obj type T
 
void merge_debug (Volume &vol, Mesh &mesh)
 merge the mesh debug into scene
 

Additional Inherited Members

- Static Public Member Functions inherited from coat::prim
static void debug_on (bool isOn=true)
 indicates whether to turn on or off the debug mode.
 
static void debug_clear ()
 clear the debug info for primitive operations
 
static void push_transform (const mat4 &t)
 set the global transform matrix to all primitives
 
static void push_translate (const vec3 &d)
 Set the translation to all primitives.
 
static void push_scale (float scale)
 Set the scale to all primitives.
 
static void push_scale (const vec3 &s)
 Set the scale to all primitives.
 
static void push_details (float details_modulator)
 set the detail level to all primitives
 
static void reset_transform ()
 reset the global transform matrix
 
- Protected Attributes inherited from coat::prim
prim * _this
 

Detailed Description

The torus.

Examples
OlympicRings.cpp.

Constructor & Destructor Documentation

◆ torus() [1/2]

coat::torus::torus ( const float & ringRadius,
const float & crossSectionRadius )

constructs a new torus object.

Parameters
ringRadiusring radius
crossSectionRadiuscross section radius.

◆ torus() [2/2]

coat::torus::torus ( const vec3 & pos,
const float & ringRadius,
const float & crossSectionRadius )

constructs a new torus object.

Parameters
postorus position
ringRadiusring radius
crossSectionRadiuscross section radius.

Member Function Documentation

◆ create_mesh()

virtual cMeshContainer * coat::torus::create_mesh ( )
protectedvirtual

creates a mesh container for the torus.

Returns
mesh pointer

Reimplemented from coat::box.

◆ diameter() [1/2]

float coat::torus::diameter ( ) const

get the ring diameter.

Returns
ring diameter

◆ diameter() [2/2]

torus & coat::torus::diameter ( const float & d)

set the ring diameter.

Parameters
dring diameter
Returns
torus reference

◆ radius() [1/2]

float coat::torus::radius ( ) const

get the ring radius.

Returns
ring radius

◆ radius() [2/2]

torus & coat::torus::radius ( const float & r)

set the ring radius.

Parameters
rring radius
Returns
torus reference

◆ rings() [1/2]

int coat::torus::rings ( ) const

get the number of rings in the mesh.

Returns
number of rings

◆ rings() [2/2]

torus & coat::torus::rings ( const int & _rings)

set the number of rings in the mesh.

Parameters
_ringsnumber of rings.
Returns
torus reference

◆ rings_angle() [1/2]

float coat::torus::rings_angle ( ) const

get the angle for torus rings

Returns
the rings angle

◆ rings_angle() [2/2]

torus & coat::torus::rings_angle ( const float & angle)

When sector is on, specifies the angle for torus rings. Default = 360 degrees.

Parameters
anglethe angle for torus rings
Returns
torus reference

◆ section_diameter() [1/2]

float coat::torus::section_diameter ( ) const

get the cross section diameter.

Returns
cross section diameter

◆ section_diameter() [2/2]

torus & coat::torus::section_diameter ( const float & section_d)

set the cross section diameter.

Parameters
section_dcross section diameter
Returns
torus reference

◆ section_radius() [1/2]

float coat::torus::section_radius ( ) const

get the cross section radius.

Returns
cross section radius

◆ section_radius() [2/2]

torus & coat::torus::section_radius ( const float & section_r)

set the cross section radius.

Parameters
section_rcross section radius
Returns
torus reference

◆ sector_on() [1/2]

bool coat::torus::sector_on ( ) const

get the flag of creating a portion of torus. Default = false.

Returns
the sector switch

◆ sector_on() [2/2]

torus & coat::torus::sector_on ( const bool & _switch)

set the flag to create a portion of torus.

Parameters
_switchthe boolean true/false value
Returns
torus reference

◆ slices() [1/2]

int coat::torus::slices ( ) const

get the number of slices in the mesh.

Returns
number of slices

◆ slices() [2/2]

torus & coat::torus::slices ( const int & _slices)

set the number of slices in the mesh.

Parameters
_slicesnumber of slices.
Returns
torus reference

◆ slices_angle() [1/2]

float coat::torus::slices_angle ( ) const

get the angle for torus slices

Returns
the slices angle

◆ slices_angle() [2/2]

torus & coat::torus::slices_angle ( const float & angle)

When sector is on, specifies the angle for torus slices. Default = 360 degrees.

Parameters
anglethe angle for torus slices
Returns
torus reference

The documentation for this class was generated from the following file: