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

The cylinder. More...

#include <CorePrimAPI.h>

Inheritance diagram for coat::cylinder:
coat::prim coat::capsule coat::cone coat::tube coat::gear coat::ngon

Public Member Functions

 cylinder ()
 constructs a new cylinder object.
 
 cylinder (const float &height, const float &radiusTop, const float &radiusBottom, const float &fillet=0.0)
 constructs a new cylinder object.
 
 cylinder (const vec3 &posTop, const vec3 &posBottom, const float &radiusTop, const float &radiusBottom, const float &fillet=0.0)
 constructs a new cylinder object.
 
cylinderpositionTop (const vec3 &pos)
 set the top position.
 
vec3 positionTop () const
 get the top position.
 
cylinderpositionBottom (const vec3 &pos)
 set the bottom position.
 
vec3 positionBottom () const
 get the bottom position.
 
cylinderradiusTop (const float &r)
 set the top radius.
 
float radiusTop () const
 get the top radius.
 
cylinderradiusBottom (const float &r)
 set the bottom radius.
 
float radiusBottom () const
 get the bottom radius.
 
cylinderradius (const float &r)
 set the radius.
 
float radius () const
 get the radius.
 
cylinderdiameterTop (const float &d)
 set the top diameter.
 
float diameterTop () const
 get the top diameter.
 
cylinderdiameterBottom (const float &r)
 set the bottom diameter.
 
float diameterBottom () const
 get the bottom diameter.
 
cylinderdiameter (const float &d)
 set the diameter.
 
float diameter () const
 get the diameter.
 
cylinderheight (const float &_height)
 set the height in the z-axis.
 
float height () const
 get the height.
 
cylindersectorAngle (const float &angle)
 set the angle for cylinder with sector.
 
float sectorAngle () const
 get the sector angle.
 
cylindertopCapScale (const float &scale)
 set the top cap scale.
 
float topCapScale () const
 get the top cap scale.
 
cylinderbottomCapScale (const float &scale)
 set the bottom cap scale.
 
float bottomCapScale () const
 get the bottom cap scale.
 
cylinderslices (const int &nslices)
 set the number of slices in the mesh.
 
int slices () const
 get the number of slices in the mesh.
 
cylinderrings (const int &nrings)
 set the number of rings in the mesh.
 
int rings () const
 get the number of rings in the mesh.
 
cylindercaps (const int &ncaps)
 set the number of caps in the mesh.
 
int caps () const
 get the number of caps in the mesh.
 
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.
 
primname (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
 
primcolor (DWORD CL)
 assign the color to the primitive (in voxels)
 
primcolor (float r, float g, float b, float a)
 assign the color to the primitive (in voxels)
 
primcolor (float r, float g, float b)
 assign the color to the primitive (in voxels)
 
primcolor (const char *colorid)
 assign the color to the primitive (in voxels)
 
primgloss (float value)
 assign the gloss for the voxel primitive, it will work only if the color already assigned
 
primroughness (float value)
 assign the roughness for the voxel primitive, it will work only if the color already assigned
 
primmetal (float value)
 the metalliclty value for the voxel primitive, it will work only if the color already assigned
 
primopacity (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)
 
primdetails (const float det_level)
 set the detail level
 
float details ()
 get the detail level
 
primtransform (const mat4 &t)
 set the transform matrix
 
mat4 transform () const
 get the transform matrix
 
primscale (float scale)
 set the scale
 
primscale (const vec3 &v)
 set the scale
 
vec3 scale () const
 get the scale
 
primtranslate (const vec3 &_pos)
 Set the primitive translation.
 
vec3 translate () const
 get the primitive translation
 
primtranslate (float x, float y, float z)
 Set the primitive translation.
 
primx (float x)
 shift the primitive along the x - axis
 
primy (float y)
 shift the primitive along the y - axis
 
primz (float z)
 shift the primitive along the z - axis
 
primauto_divide (float average_div)
 set the auto devide
 
primstep_divide (float step)
 set the step devide
 
primfillet (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 cylinder.
 
cMeshContainer * getCylinderPrim (bool iscone=false)
 get a mesh container for the cylinder without account of fillet.
 
mat4 getLTransform ()
 get a transform matrix between standard cylinder and cylinder with custom 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
 

Friends

class cone
 
class capsule
 
class ngon
 
class tube
 

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

Constructor & Destructor Documentation

◆ cylinder() [1/2]

coat::cylinder::cylinder ( const float & height,
const float & radiusTop,
const float & radiusBottom,
const float & fillet = 0.0 )

constructs a new cylinder object.

Parameters
heightcylinder height
radiusTopradius at top
radiusBottomradius at bottom
filletfillet radius

◆ cylinder() [2/2]

coat::cylinder::cylinder ( const vec3 & posTop,
const vec3 & posBottom,
const float & radiusTop,
const float & radiusBottom,
const float & fillet = 0.0 )

constructs a new cylinder object.

Parameters
posTopposition at top
posBottomposition at bottom
radiusTopradius at top
radiusBottomradius at bottom
filletfillet radius

Member Function Documentation

◆ bottomCapScale() [1/2]

float coat::cylinder::bottomCapScale ( ) const

get the bottom cap scale.

Returns
the scale value

◆ bottomCapScale() [2/2]

cylinder & coat::cylinder::bottomCapScale ( const float & scale)

set the bottom cap scale.

Parameters
scalethe scale value
Returns
cylinder reference

◆ caps() [1/2]

int coat::cylinder::caps ( ) const

get the number of caps in the mesh.

Returns
number of caps.

◆ caps() [2/2]

cylinder & coat::cylinder::caps ( const int & ncaps)

set the number of caps in the mesh.

Parameters
ncapsnumber of caps.
Returns
cylinder reference

◆ create_mesh()

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

creates a mesh container for the cylinder.

Returns
mesh pointer

Reimplemented from coat::prim.

Reimplemented in coat::capsule, coat::cone, coat::gear, coat::ngon, and coat::tube.

◆ diameter() [1/2]

float coat::cylinder::diameter ( ) const

get the diameter.

Returns
diameter value

◆ diameter() [2/2]

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

set the diameter.

Parameters
ddiameter
Returns
cylinder reference
Examples
DoorStop.cpp, csg_surface.cpp, and csg_voxels.cpp.

◆ diameterBottom() [1/2]

float coat::cylinder::diameterBottom ( ) const

get the bottom diameter.

Returns
diameter value

◆ diameterBottom() [2/2]

cylinder & coat::cylinder::diameterBottom ( const float & r)

set the bottom diameter.

Parameters
ddiameter
Returns
cylinder reference
Examples
csg_surface.cpp, and csg_voxels.cpp.

◆ diameterTop() [1/2]

float coat::cylinder::diameterTop ( ) const

get the top diameter.

Returns
diameter value

◆ diameterTop() [2/2]

cylinder & coat::cylinder::diameterTop ( const float & d)

set the top diameter.

Parameters
ddiameter
Returns
cylinder reference
Examples
csg_surface.cpp, and csg_voxels.cpp.

◆ fillet_relative()

virtual float coat::cylinder::fillet_relative ( )
virtual

calculates a fillet relative value (0..1).

Returns
fillet relative value

Reimplemented from coat::prim.

Reimplemented in coat::cone, coat::ngon, and coat::tube.

◆ getCylinderPrim()

cMeshContainer * coat::cylinder::getCylinderPrim ( bool iscone = false)
protected

get a mesh container for the cylinder without account of fillet.

Parameters
isconecone flag
Returns
the new mesh container

◆ getLTransform()

mat4 coat::cylinder::getLTransform ( )
protected

get a transform matrix between standard cylinder and cylinder with custom parameters

Returns
transform matrix

◆ height() [1/2]

float coat::cylinder::height ( ) const

get the height.

Returns
height value

◆ height() [2/2]

cylinder & coat::cylinder::height ( const float & _height)

set the height in the z-axis.

Parameters
_heightheight
Returns
cylinder reference
Examples
DoorStop.cpp, Dumbbell.cpp, HoneyComb.cpp, capsule.cpp, csg_surface.cpp, csg_voxels.cpp, gear.cpp, and tube.cpp.

◆ positionBottom() [1/2]

vec3 coat::cylinder::positionBottom ( ) const

get the bottom position.

Returns
position

◆ positionBottom() [2/2]

cylinder & coat::cylinder::positionBottom ( const vec3 & pos)

set the bottom position.

Parameters
posposition
Returns
cylinder reference

◆ positionTop() [1/2]

vec3 coat::cylinder::positionTop ( ) const

get the top position.

Returns
position

◆ positionTop() [2/2]

cylinder & coat::cylinder::positionTop ( const vec3 & pos)

set the top position.

Parameters
posposition
Returns
cylinder reference

◆ radius() [1/2]

float coat::cylinder::radius ( ) const

get the radius.

Returns
radius value

◆ radius() [2/2]

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

set the radius.

Parameters
rradius
Returns
cylinder reference
Examples
DoorStop.cpp, and Dumbbell.cpp.

◆ radiusBottom() [1/2]

float coat::cylinder::radiusBottom ( ) const

get the bottom radius.

Returns
radius value

◆ radiusBottom() [2/2]

cylinder & coat::cylinder::radiusBottom ( const float & r)

set the bottom radius.

Parameters
rradius
Returns
cylinder reference
Examples
HoneyComb.cpp, capsule.cpp, gear.cpp, and tube.cpp.

◆ radiusTop() [1/2]

float coat::cylinder::radiusTop ( ) const

get the top radius.

Returns
radius value

◆ radiusTop() [2/2]

cylinder & coat::cylinder::radiusTop ( const float & r)

set the top radius.

Parameters
rradius
Returns
cylinder reference
Examples
HoneyComb.cpp, capsule.cpp, gear.cpp, and tube.cpp.

◆ rings() [1/2]

int coat::cylinder::rings ( ) const

get the number of rings in the mesh.

Returns
number of rings.

◆ rings() [2/2]

cylinder & coat::cylinder::rings ( const int & nrings)

set the number of rings in the mesh.

Parameters
nringsnumber of rings.
Returns
cylinder reference

◆ sectorAngle() [1/2]

float coat::cylinder::sectorAngle ( ) const

get the sector angle.

Returns
angle value

◆ sectorAngle() [2/2]

cylinder & coat::cylinder::sectorAngle ( const float & angle)

set the angle for cylinder with sector.

Parameters
anglethe sector angle
Returns
cylinder reference
Examples
DoorStop.cpp.

◆ slices() [1/2]

int coat::cylinder::slices ( ) const

get the number of slices in the mesh.

Returns
number of slices.

◆ slices() [2/2]

cylinder & coat::cylinder::slices ( const int & nslices)

set the number of slices in the mesh.

Parameters
nslicesnumber of slices.
Returns
cylinder reference

◆ topCapScale() [1/2]

float coat::cylinder::topCapScale ( ) const

get the top cap scale.

Returns
the scale value

◆ topCapScale() [2/2]

cylinder & coat::cylinder::topCapScale ( const float & scale)

set the top cap scale.

Parameters
scalethe scale value
Returns
cylinder reference

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