Shape class

From Solid Graphics Wiki

Revision as of 01:06, 26 September 2012 by Rgrof (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
Shape class
Namespace: SKL3D
Base type: (None)
Include: Skl3D.h
Lib (Release): SKL.lib
Lib (Debug): SKL_D.lib

The Shape class is representation of a triangle mesh.


The class provides only basic constructors - a constructor with no parameters and a copy constructor.


Field name Type Description
points PointList Array of shape's points.
triangles TriangleByRefList Array of shape's triangles.


Method name Description
CreateBox Creates triangle mesh of a box shape.
CreateCone Creates triangle mesh of a cone shape.
CreateCylinder Creates triangle mesh of a cylinder shape.
CreateSphere Creates triangle mesh of sphere shape.
CreateTorus Creates triangle mesh of a torus shape.
Area Returns area of the shape surface.
Volume Ruturns volume of the shape. The volume is valid number only if the object's triangle mesh represents a solid without "surface skin" holes (This does not mean that the shape cannot have holes - it means that it's surface must not be missing any triangles).
MassCenter Returns mass center of the shape. The mass center is correctly calculated only if the shape object represents a solid object.
BoundingBox Returns axis oriented bounding box of the shape.
Move Moves the shape point by specified vector or by transforming of all it's points using given matrix.
RotateZYX Rotates all shape points by specified angles around origin of the coordinate system, first around Z axis, then Y axis and then X axis.
RotateYXZ Rotates all shape points by specified angles around origin of the coordinate system, first around Y axis, then X axis and then Z axis.
InverseRotateZYX Performs rotation inverse to what the RotateZYX method does.
InverseRotateYXZ Performs rotation inverse to what the RotateYXZ method does.
Scale Scales all shape point coordinates by given factor.
Transform Transforms all shape points using given matrix.
AlignToGrid Aligns all shape points to specified grid.
SnapPoints Merges shape points which are withing specified distance to each other.
RemoveUnusedPoints Removes all unused points from the point array fieldd and updates point indexes of affected triangles.
CalculateNormals Calculates normals for rendering of the shape.
Split If the shape consists of multiple separate objects then the Split method returns array of the individual shapes. If shape is already a single object then the return array will have just one object.
GetLeftmostPointIndex Returns index of the furthest shape point to the left side of specified plane.
GetLeftmostPoint Returns coordinates of the furthest shape point to the left side of specified plane.
GetRightmostPointIndex Returns index of the furthest shape point to the right side of specified plane.
GetRightmostPoint Returns coordinates of the furthest shape point to the right side of specified plane.
GetTriangle Returns specified shape triangle as Triangle class object.
GetFace Returns all triangle ids which are neighbours of specified triangle and have the same normal vector as specified triangle, or neighbours of such neighbours and their neighbours having the same normal. For example if shape's triangle mesh is a cube then the function always returns two triangles which together form a cube's face - a square.
GetEdge Returns shape's single edge coordinates. The edge is identified by it's starting linesegment, the GetEdge method then finds and returns all linesegments of specified edge.
GetEdges Returns all shapes crease-angle edges.
GetBoundaryEdges Returns linesegments of shape's triangle mesh boundary - that is edges of all triangles each edge belongs to just one triangle. Shapes which represent solid objects do not have boundary edges.
GetEdgeTriangles Returns all triangles which have boundary edges.
DeletePoint Deletes specified shape point and updates triangles using this point to use different (specified) point.
GetPointNeighbourList Returns all neighbour points to specified pointon the shapes triangle mesh.
IsValidTopology Returns true if shape's topology is valid solid and therefore valid to perform constructive solid geometry operation on.
Intersects Performs intersection test of given LineSegment or another shape wich the shape object instance.
LoadFromXML Loads the shape triangle mesh from specified XmlReader.
SaveToXML Appends the shape triangle mesh to MemoryBuffer as XML.
CreateNew Creates new copy (clone) of the shape object instance.
AreTriangleAttributesEqual Performs test whether two triangle attributes are equal.
CopyTriangleAttributes Copies one triangle's attributes to another.
OnTriangleArraySizeChange Notification function which can be used to inform the object instance about change in it's triangle mesh.

Below methods are part of the SolidKit Library Pro package only!

Method name Description
ReduceCollinearTriangles Reduces number of triangles in the shape's faces.
RemoveThinTriangles Removes thin triangles from the shape.
InsertPoint Inserts a point onto the shape surface and modifies affected triangles.
FlatSubdivide Does flat subdivision of all shape triangles.
SmoothSubdivide Does (Loop's) smooth subdivision of all shape triagles.
Mirror Mirrors the shape around specified plane.
RoundEdge (This method is in Alpha development stage!) Rounds specified shape edge.


+= The += operator adds points and triangles of another shape object to the instance. The operator does no do any optimization such as removing common points from resulting shape - after it is finished the same point coordinates can be present in the shape's point array field multiple times.

See Also


SolidKit Library Documentation

Personal tools