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

The box. More...

#include <CorePrimAPI.h>

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

Public Member Functions

 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.
 
boxaxis (const vec3 &directionX)
 set the x-direction
 
boxaxis (const vec3 &directionX, const vec3 &directionY)
 set the x and y direction
 
boxaxis (const vec3 &directionX, const vec3 &directionY, const vec3 &directionZ)
 set the x, y and z direction
 
boxreset_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
 
boxdivide (int nx, int ny, int nz)
 set the number deviding
 
boxsize (const vec3 &_size)
 set the box size
 
boxsize (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.
 
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

void init ()
 initialize the default parameters
 
virtual cMeshContainer * create_mesh ()
 creates a mesh container for the box.
 
- 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 torus
 

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 box.

Examples
BrickWall.cpp.

Constructor & Destructor Documentation

◆ box() [1/4]

coat::box::box ( float sizeX,
float sizeY,
float sizeZ )

constructs a new box object.

constructs a new box object.

Parameters
sizeXsize in the x-axis
sizeYsize in the y-axis
sizeZsize in the z-axis

◆ box() [2/4]

coat::box::box ( const vec3 & size)

constructs a new box object.

Parameters
posbox position
sizebox size

◆ box() [3/4]

coat::box::box ( const vec3 & pos,
const vec3 & size )

constructs a new box object.

Parameters
posbox position
sizebox size

◆ box() [4/4]

coat::box::box ( const vec3 & pos,
const vec3 & size,
float fillet )

constructs a new box object.

Parameters
posbox position
sizebox size
filletround radius value

Member Function Documentation

◆ axis() [1/3]

box & coat::box::axis ( const vec3 & directionX)

set the x-direction

Parameters
directionXthe x-direction
Returns
box reference

◆ axis() [2/3]

box & coat::box::axis ( const vec3 & directionX,
const vec3 & directionY )

set the x and y direction

Parameters
directionXthe x-direction
directionYthe y-direction
Returns
box reference

◆ axis() [3/3]

box & coat::box::axis ( const vec3 & directionX,
const vec3 & directionY,
const vec3 & directionZ )

set the x, y and z direction

Parameters
directionXthe x-direction
directionYthe y-direction
directionZthe z-direction
Returns
box reference

◆ axis_x()

vec3 coat::box::axis_x ( )

get the x-axis

Returns
vec3 axis

◆ axis_y()

vec3 coat::box::axis_y ( )

get the y-axis

Returns
vec3 axis

◆ axis_z()

vec3 coat::box::axis_z ( )

get the z-axis

Returns
vec3 axis

◆ create_mesh()

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

creates a mesh container for the box.

Returns
mesh pointer

Reimplemented from coat::prim.

Reimplemented in coat::lathe, and coat::torus.

◆ divide()

box & coat::box::divide ( int nx,
int ny,
int nz )

set the number deviding

Parameters
nxnumber deviding along the x-axis
nynumber deviding along the y-axis
nznumber deviding along the z-axis
Returns
box reference

◆ fillet_relative()

virtual float coat::box::fillet_relative ( )
virtual

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

Returns
fillet relative value

Reimplemented from coat::prim.

◆ reset_axis()

box & coat::box::reset_axis ( )

reset the x, y and z direction

Returns
box reference

◆ size() [1/3]

vec3 coat::box::size ( ) const

get the box size.

Returns
size

◆ size() [2/3]

box & coat::box::size ( const vec3 & _size)

set the box size

Parameters
_sizesize
Returns
box reference
Examples
BrickWall.cpp, and cup.cpp.

◆ size() [3/3]

box & coat::box::size ( float x,
float y,
float z )

set the box size

Parameters
xsize x
ysize y
zsize z
Returns
box reference

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