Itasca C++ Interface
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
itascaxd::IGeomPoly Class Referenceabstract

A class representing a single closed polygon made up of a list of edges. More...

#include <igeompoly.h>

Public Member Functions

virtual IThinggetIThing ()=0
 Return an IThing interface for this object.
 
virtual const IThinggetIThing () const =0
 Return a const IThing interface for this object.
 
virtual uint64 getSize () const =0
 Returns the number of edges associated with this polygon. This is also the number of points if the polygon is closed.
 
virtual uint64 getNumFakeEdges () const =0
 Returns the number of fake edges associated with this polygon. Only irregular blocks with internal polygons (boundaries) have fake edges.
 
virtual IGeomEdgegetEdge (uint32 index)=0
 Returns the edge at index index in the list of edges associated with the polygon. Will return 0 if index >= getSize().
 
virtual const IGeomEdgegetEdge (uint32 index) const =0
 Returns the edge at index index in the list of edges associated with the polygon. Will return 0 if index >= getSize().
 
virtual bool addEdge (IGeomEdge *edge, bool throwException=true, bool forceFlip=false)=0
 
virtual IGeomEdgeremoveEdge ()=0
 
virtual bool isValid () const =0
 Checks the validity of the polygon - the polygon must be fully closed, and each edge must match a point in the next edge.
 
virtual IGeomPointgetPoint (uint32 index)=0
 Returns the point at index /a index in the polygon, assuming it is valid.
 
virtual const IGeomPointgetPoint (uint32 index) const =0
 Returns the point at index /a index in the polygon, assuming it is valid.
 
virtual bool getFlip (uint32 index) const =0
 
virtual DVect getVector (uint32 index) const =0
 Returns the vector from point index to point index+1 as you go around the polygon.
 
virtual DVect getCentroid () const =0
 Returns the centroid, calculated as the average of the point positions.
 
virtual double getArea () const =0
 Returns the area of the polygon, assuming the polygon is planar and radially convex about the centroid.
 
virtual DAVect getDANormal () const =0
 Returns the normal vector or the polygon, based on an average of each vertex if the polygon is not planar.
 
virtual DVect3 getNormal () const =0
 Returns the normal vector or the polygon as used in ThingData.
 
virtual bool isPlanar (const double &tolerance=1e-7) const =0
 
virtual bool isConvex (const double &tolerance=1e-7) const =0
 Returns true if the polygon is convex within tolerance.
 
virtual bool isIn (const DVect &v, DVect *on=0, const double &tolerance=1e-7) const =0
 
virtual DVect getClosestPoint (const DVect &v) const =0
 Returns the closest point to /a v on the polygon, which could be on a point, on an edge, or on the surface of the polygon.
 
virtual int getConnectIndex () const
 Returns the connect index, computed.
 
virtual int getManifoldIndex () const
 Returns the manifold index, computed.
 
virtual int getFrontSideIndex () const
 Returns the front side index, computed.
 
virtual int getBackSideIndex () const
 Returns the back side index, computed.
 
virtual CLinkType< IGeomPolygetNext (uint32 index) const =0
 Returns an interface to a CLinkType<> object, a const pointer to the next object in the linked list.
 
virtual LinkType< IGeomPolygetNext (uint32 index)=0
 Returns an interface to a LinkType<> object, a pointer to the next object in the linked list.
 
virtual const GeomBase * getGeomBase () const =0
 Return const GeomBase.
 
virtual DVect convertToGlobal (double u, double v) const =0
 
virtual DVect2 convertToLocal (const DVect &pos) const =0
 
virtual void triangulatedList (FArray< DVect > *ret, const double &tolerance=1e-7)=0
 Return a list of triangulated vertices for plotting.
 
virtual uint32 index (const IGeomEdge *edge) const =0
 
virtual uint32 index (const IGeomPoly *vert) const =0
 
virtual void setEdge (uint32 ind, IGeomEdge *edge)=0
 

Static Public Attributes

static const TType type_ = 0x4c815bce
 The type identification number for this class, for use in convert_cast() and convert_getcast().
 

Detailed Description

A class representing a single closed polygon made up of a list of edges.

Member Function Documentation

◆ addEdge()

virtual bool itascaxd::IGeomPoly::addEdge ( IGeomEdge * edge,
bool throwException = true,
bool forceFlip = false )
pure virtual

Adds an edge to the polygon. The point at one end of the edge must match the point at the free end of the last edge of the polygon. Return true if successful, false if not. By default throws an exception if the edge cannot be added validly. Set throwException to false if you do not want an exception thrown. Set forceFlip to true if you want to force the edge to be flipped on entry - only applies to the first edge added.

◆ convertToGlobal()

virtual DVect itascaxd::IGeomPoly::convertToGlobal ( double u,
double v ) const
pure virtual

Convert to global coordinate the point on the surface. If (u,v) = (0,0) it will be position of centroid, If (u,v) = (1,0) – position of point(0), (u,v) = (0,1) – position of point(1) . Returns zero vector if polygon is not valid.

◆ convertToLocal()

virtual DVect2 itascaxd::IGeomPoly::convertToLocal ( const DVect & pos) const
pure virtual

Convert to local polygon coordinate (u,v) of a 3d position point on the polygon. No check if the point is on the polygon, or polygon is planar and convex.

◆ getFlip()

virtual bool itascaxd::IGeomPoly::getFlip ( uint32 index) const
pure virtual

When following the edge order around the polygon, the order of vertices could go from end1 to end2 or from end2 to end1. Returns true if the vertex order is from end2 to end1, false otherwise.

◆ isIn()

virtual bool itascaxd::IGeomPoly::isIn ( const DVect & v,
DVect * on = 0,
const double & tolerance = 1e-7 ) const
pure virtual

Returns true if the point v, after being projected onto the plane of the polygon, falls inside the polygon boundaries. on (if provided) is filled with the projected point. tolerance is used to determine if the projected point is inside or outside.

◆ isPlanar()

virtual bool itascaxd::IGeomPoly::isPlanar ( const double & tolerance = 1e-7) const
pure virtual

Returns true if the polygon is planar within tolerance,by checking the distance of vertices from the average plane. Returns false if maxdist*cendist > tolerance*area, where maxdist is the maximum distance of a vertex from the average plane, cendist is the distance from the centroid to that vertex, and area is the area of the polygon assuming it was planar.

◆ removeEdge()

virtual IGeomEdge * itascaxd::IGeomPoly::removeEdge ( )
pure virtual

Removes the last edge from the polygon, reducing it's size by one and rendering it invalid (if it was previously valid). Returns a pointed to the edge removed.


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