AngelCAD  1.5-00
Public Member Functions | List of all members
polyhedron Class Reference

Closed polyhedron volume defined by vertices and planar faces. More...

#include <angelcad.h>

Inheritance diagram for polyhedron:
solid shape

Public Member Functions

 polyhedron (array< pos3d@>@ points)
 Construct polyhedron from a point cloud. The result is the convex hull polyhedron. More...
 
 polyhedron (array< pos3d@>@ points, array< pface@>@ faces)
 Construct polyhedron from arrays of points and faces. Face normals must point out. More...
 
 polyhedron (string file, int id=- 1)
 Read polyhedron from file (AMF,OBJ or OFF formats) More...
 
double face_area (uint iface) const
 polyhedron face area More...
 
double volume () const
 polyhedron volume More...
 
pface@ face (uint iface) const
 polyhedron face More...
 
pos3d@ vertex (uint iv) const
 polyhedron vertex More...
 
uint nface () const
 Number of faces. More...
 
uint nvert () const
 Number of vertices. More...
 
void flip_face (uint iface)
 Flip polyhedron face normal. More...
 
void flip_faces ()
 Flip all polyhedron face normals. More...
 
void set_vertex (uint iv, pos3d@ pos)
 Set vertex position. More...
 
void verify () const
 Verify that the polyhedron is closed and without errors. More...
 
- Public Member Functions inherited from solid
solid@ opAdd (solid@ b)
 Boolean union operator+ overload. More...
 
solid@ opAnd (solid@ b)
 Boolean intersection operator& overload. More...
 
solid@ opMul (tmatrix@ matrix)
 Transform object by matrix multiplication: solid@ o2 = T * o1. More...
 
solid@ opSub (solid@ b)
 Boolean difference operator- overload. More...
 
- Public Member Functions inherited from shape
boundingbox@ box () const
 Return bounding box of object. More...
 
tmatrix@ transform () const
 Return transformation matrix of object. More...
 
void write_csg (string path)
 Write object to OpenSCAD .csg file. More...
 
void write_xcsg (string path, double secant_tolerance=- 1.0)
 Write object to .xcsg file for processing by xcsg program. More...
 

Detailed Description

Closed polyhedron volume defined by vertices and planar faces.

a polyhedron is a general 3d object, defined by its vertices and polyhedron faces.
It is useful in many contexts. It can be constructed directly or by reference to an input file.

Constructor & Destructor Documentation

◆ polyhedron() [1/3]

polyhedron::polyhedron ( array< pos3d@>@  points)

Construct polyhedron from a point cloud. The result is the convex hull polyhedron.

Parameters
pointsarray@

◆ polyhedron() [2/3]

polyhedron::polyhedron ( array< pos3d@>@  points,
array< pface@>@  faces 
)

Construct polyhedron from arrays of points and faces. Face normals must point out.

Parameters
pointsarray@
facesarray@

◆ polyhedron() [3/3]

polyhedron::polyhedron ( string  file,
int  id = - 1 
)

Read polyhedron from file (AMF,OBJ or OFF formats)

Parameters
filestring
idint

Member Function Documentation

◆ face()

pface@ polyhedron::face ( uint  iface) const

polyhedron face

Parameters
ifaceuint, index of polyhedron face
Returns
pface@, polyhedron face

◆ face_area()

double polyhedron::face_area ( uint  iface) const

polyhedron face area

Parameters
ifaceuint, index of polyhedron face
Returns
double, computed area of polyhedron face

◆ flip_face()

void polyhedron::flip_face ( uint  iface)

Flip polyhedron face normal.

Parameters
ifaceuint, index of polyhedron face

◆ flip_faces()

void polyhedron::flip_faces ( )

Flip all polyhedron face normals.

◆ nface()

uint polyhedron::nface ( ) const

Number of faces.

Returns
uint, number of faces in polyhedron

◆ nvert()

uint polyhedron::nvert ( ) const

Number of vertices.

Returns
uint, number of vertices in polyhedron

◆ set_vertex()

void polyhedron::set_vertex ( uint  iv,
pos3d@  pos 
)

Set vertex position.

Parameters
ivuint, index of polyhedron vertex
pospos3d@, new position of vertex

◆ verify()

void polyhedron::verify ( ) const

Verify that the polyhedron is closed and without errors.

◆ vertex()

pos3d@ polyhedron::vertex ( uint  iv) const

polyhedron vertex

Parameters
ivuint, index of polyhedron vertex
Returns
pos3d@, polyhedron vertex position

◆ volume()

double polyhedron::volume ( ) const

polyhedron volume

Returns
double, computed volume of polyhedron

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