Itasca C++ Interface
Loading...
Searching...
No Matches
igeompoly.h
Go to the documentation of this file.
1#pragma once
2// igeompoly.h
3
6
7#include "ilinktype.h"
8#include "dim.h"
9#include "base/src/farray.h"
10
11namespace itasca {
12 class IThing;
13}
14
15namespace itascaxd {
16 using namespace itasca;
17
18 class IGeomPoint;
19 class IGeomEdge;
20 class GeomBase;
23 class IGeomPoly {
24 public:
26 inline static const TType type_ = 0x4c815bce;
27
29 virtual IThing * getIThing()=0;
31 virtual const IThing * getIThing() const=0;
32
34 virtual uint64 getSize() const=0;
36 virtual uint64 getNumFakeEdges() const =0;
38 virtual IGeomEdge * getEdge(uint32 index)=0;
40 virtual const IGeomEdge * getEdge(uint32 index) const=0;
45 virtual bool addEdge(IGeomEdge *edge,bool throwException=true,bool forceFlip=false)=0;
48 virtual IGeomEdge * removeEdge()=0;
50 virtual bool isValid() const=0;
52 virtual IGeomPoint * getPoint(uint32 index)=0;
54 virtual const IGeomPoint *getPoint(uint32 index) const=0;
57 virtual bool getFlip(uint32 index) const=0;
59 virtual DVect getVector(uint32 index) const=0;
61 virtual DVect getCentroid() const=0;
63 virtual double getArea() const=0;
65 virtual DAVect getDANormal() const=0;
67 virtual DVect3 getNormal() const=0;
71 virtual bool isPlanar(const double &tolerance=1e-7) const=0;
73 virtual bool isConvex(const double &tolerance=1e-7) const=0;
77 virtual bool isIn(const DVect &v,DVect *on=0,const double &tolerance=1e-7) const=0;
79 virtual DVect getClosestPoint(const DVect &v) const=0;
80
82 virtual int getConnectIndex() const { return 0; }
84 virtual int getManifoldIndex() const { return 0; }
86 virtual int getFrontSideIndex() const { return 0; }
88 virtual int getBackSideIndex() const { return 0; }
89
91 virtual CLinkType<IGeomPoly> getNext(uint32 index) const=0;
93 virtual LinkType<IGeomPoly> getNext(uint32 index) =0;
95 virtual const GeomBase * getGeomBase() const=0;
98 virtual DVect convertToGlobal(double u, double v) const =0;
99#ifdef THREED
102 virtual DVect2 convertToLocal(const DVect &pos) const =0;
103#endif
104
106 virtual void triangulatedList(FArray<DVect> * ret, const double &tolerance = 1e-7)=0;
107
108 virtual uint32 index(const IGeomEdge *edge) const = 0;
109 virtual uint32 index(const IGeomPoly *vert) const = 0;
110 virtual void setEdge(uint32 ind, IGeomEdge *edge) = 0;
111
112 };
113} // namespace itascaxd
114// EoF
An array class that attempts to minimize unnecessary heap access.
Definition farray.h:25
Base class for items that will be stored in containers.
Definition ithing.h:30
Interface for a user-defined geometric edge, defined as the line between two IGeomPoint objects.
Definition igeomedge.h:24
Interface for a user-defined geometric point.
Definition igeompoint.h:18
A class representing a single closed polygon made up of a list of edges.
Definition igeompoly.h:23
virtual DVect2 convertToLocal(const DVect &pos) const =0
static const TType type_
The type identification number for this class, for use in convert_cast() and convert_getcast().
Definition igeompoly.h:26
virtual IGeomEdge * removeEdge()=0
virtual double getArea() const =0
Returns the area of the polygon, assuming the polygon is planar and radially convex about the centroi...
virtual int getFrontSideIndex() const
Returns the front side index, computed.
Definition igeompoly.h:86
virtual DVect convertToGlobal(double u, double v) const =0
virtual const IGeomPoint * getPoint(uint32 index) const =0
Returns the point at index /a index in the polygon, assuming it is valid.
virtual const IGeomEdge * getEdge(uint32 index) const =0
Returns the edge at index index in the list of edges associated with the polygon. Will return 0 if in...
virtual LinkType< IGeomPoly > getNext(uint32 index)=0
Returns an interface to a LinkType<> object, a pointer to the next object in the linked list.
virtual IThing * getIThing()=0
Return an IThing interface for this object.
virtual DVect getVector(uint32 index) const =0
Returns the vector from point index to point index+1 as you go around the polygon.
virtual bool isConvex(const double &tolerance=1e-7) const =0
Returns true if the polygon is convex within tolerance.
virtual uint64 getNumFakeEdges() const =0
Returns the number of fake edges associated with this polygon. Only irregular blocks with internal po...
virtual int getConnectIndex() const
Returns the connect index, computed.
Definition igeompoly.h:82
virtual void triangulatedList(FArray< DVect > *ret, const double &tolerance=1e-7)=0
Return a list of triangulated vertices for plotting.
virtual DVect3 getNormal() const =0
Returns the normal vector or the polygon as used in ThingData.
virtual bool isIn(const DVect &v, DVect *on=0, const double &tolerance=1e-7) const =0
virtual DVect getCentroid() const =0
Returns the centroid, calculated as the average of the point positions.
virtual const IThing * getIThing() 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 po...
virtual bool addEdge(IGeomEdge *edge, bool throwException=true, bool forceFlip=false)=0
virtual int getBackSideIndex() const
Returns the back side index, computed.
Definition igeompoly.h:88
virtual int getManifoldIndex() const
Returns the manifold index, computed.
Definition igeompoly.h:84
virtual IGeomEdge * getEdge(uint32 index)=0
Returns the edge at index index in the list of edges associated with the polygon. Will return 0 if in...
virtual DAVect getDANormal() const =0
Returns the normal vector or the polygon, based on an average of each vertex if the polygon is not pl...
virtual bool isValid() const =0
Checks the validity of the polygon - the polygon must be fully closed, and each edge must match a poi...
virtual bool isPlanar(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,...
virtual CLinkType< IGeomPoly > getNext(uint32 index) const =0
Returns an interface to a CLinkType<> object, a const pointer to the next object in the linked list.
virtual IGeomPoint * getPoint(uint32 index)=0
Returns the point at index /a index in the polygon, assuming it is valid.
virtual bool getFlip(uint32 index) const =0
virtual const GeomBase * getGeomBase() const =0
Return const GeomBase.
DIM - Provides code portability between 2D and 3D codes.
An array class that attempts to minimize unnecessary heap access.
uint32 TType
class type indicator
Definition basedef.h:46
DVect3 DVect
Vector of doubles, either 2D or 3D.
Definition dim.h:154
DAVect3 DAVect
Angular vector of doubles, either 2D or 3D.
Definition dim.h:162
Interface for LinkType<> objects, POD that contain both the pointer to the next object and an index f...
namespace Itasca
Definition basememory.cpp:10
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4