3ds Max C++ API Reference
|
Describes a single polygon in a PolyShape using linear segments. More...
#include <polyshp.h>
Public Member Functions | |
CoreExport | PolyLine () |
Constructor. | |
CoreExport | PolyLine (const PolyLine &from) |
Constructor. | |
CoreExport | ~PolyLine () |
Destructor. | |
CoreExport void | Init () |
Initializes the PolyLine. | |
CoreExport BOOL | SetNumPts (int count, BOOL keep=TRUE) |
Sets the number of points in the polyline. | |
CoreExport void | Append (const PolyPt &p) |
Appends the specified point to the polyline. | |
CoreExport void | Insert (int where, const PolyPt &p) |
Inserts the specified point at the location passed. | |
CoreExport void | Delete (int where) |
Deletes the specified point. | |
CoreExport void | Reverse (BOOL keepZero=FALSE) |
Reverses the order of the points in the polyline. | |
CoreExport PolyLine & | operator= (const PolyLine &from) |
Assignment operator. | |
CoreExport PolyLine & | operator= (Spline3D &from) |
Assignment operator. | |
CoreExport PolyPt & | operator[] (int index) |
Array access operator. | |
CoreExport const PolyPt & | operator[] (int index) const |
CoreExport void | Dump (const MCHAR *title=NULL) |
Called to dump the polyline structure via DebugPrint(). | |
CoreExport void | SpliceLine (int where, PolyLine &source, int splicePoint) |
CoreExport BOOL | HitsSegment (Point2 p1, Point2 p2, BOOL findAll=FALSE, IntersectionCallback3D *cb=nullptr) |
Tells if the line segment defined between the two input points intersects this PolyLine object or not. | |
CoreExport BOOL | HitsPolyLine (PolyLine &line, BOOL findAll=FALSE, IntersectionCallback3D *cb=nullptr) |
Tells if the input PolyLine intersects this PolyLine or not. | |
CoreExport MtlID | GetMatID (int segment) |
Returns the material ID for the specified segment. | |
CoreExport void | GetSmoothingMap (IntTab &map) |
CoreExport IOResult | Save (ISave *isave) |
CoreExport IOResult | Load (ILoad *iload) |
CoreExport void | Swap (PolyLine &line) |
Lets the developer transfer the content of a line object to another object without suffering from any copy penalties. | |
Opened/Closed/Self Intersects/Clockwise/Surrounds Point | |
void | Close () |
Marks the polyline as closed by setting the POLYLINE_CLOSED flag to one. | |
CoreExport BOOL | IsClosed () const |
Tells if the polyline is closed or not. | |
void | Open () |
Marks the polyline as open by resetting the POLYLINE_CLOSED flag to zero. | |
CoreExport BOOL | IsOpen () const |
Tells if the polyline is open or not. | |
void | SetNoSelfInt () |
Sets the POLYLINE_NO_SELF_INT flag. | |
BOOL | IsNoSelfInt () const |
Returns true if the POLYLINE_NO_SELF_INT flag is set, false if it is not. | |
CoreExport BOOL | SurroundsPoint (Point2 &point) |
Returns TRUE if the specified point is surrounded (contained within) this PolyLine. | |
CoreExport float | CurveLength () |
Returns the length of the calling PolyLine object. | |
CoreExport BOOL | IsClockWise () |
Returns true if the polyline is clockwise in the XY plane (ignoring the Z dimension), false otherwise. | |
CoreExport BOOL | SelfIntersects (BOOL findAll=FALSE, IntersectionCallback3D *cb=nullptr) |
Returns TRUE if the polyline intersects itself in the XY plane (ignoring the Z dimension), false otherwise. | |
Vertex/Segment counts | |
int | Verts () const |
Returns the number of vertices (points) in the polyline. | |
CoreExport int | Segments () const |
Returns the number of segments (edges between vertices) of the polyline. | |
Bounding Box/InvalidateGeomCache | |
CoreExport void | BuildBoundingBox (void) |
Computes the bounding box of the polyline. | |
CoreExport void | InvalidateGeomCache () |
Ensures that the calling PolyLine object has flushed out any cached data it may have had. | |
CoreExport Box3 | GetBoundingBox (Matrix3 *tm=NULL) |
Returns the bound box of the polyline. | |
Render/Select/Snap/Transform | |
CoreExport void | Render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat) |
CoreExport void | Render (GraphicsWindow *gw, Material *ma, int numMat, BOOL colorSegs, BitArray &segsel, BOOL useStartSegments=TRUE) |
This renders the polyline to the display. | |
CoreExport BOOL | Select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE) |
CoreExport void | Snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm, DWORD vflags) |
CoreExport void | Transform (const Matrix3 &tm) |
Transforms the points of the polyline by the specified matrix. | |
Capping Method | |
CoreExport int | Cap3DS (CapVert *capverts, MeshCapInfo &capInfo, DWORD options=0) |
Interpolated Points/Tangent Vectors | |
CoreExport Point3 | InterpPiece3D (int segment, float t) |
Returns a point interpolated on a segment between two points. | |
CoreExport Point3 | InterpCurve3D (float u, int ptype=POLYSHP_INTERP_SIMPLE) |
Returns a point interpolated on the entire curve. | |
CoreExport Point3 | TangentPiece3D (int segment, float t) |
Returns a tangent vector interpolated on a segment between two points. | |
CoreExport Point3 | TangentCurve3D (float u, int ptype=POLYSHP_INTERP_SIMPLE) |
Returns a tangent vector interpolated on the entire curve. | |
Public Attributes | |
int | numPts |
The number of points in the polyline. | |
PolyPt * | pts |
Pointer to the actual points in the polyline. | |
DWORD | flags |
See PolyLine Flags. | |
Box3 | bdgBox |
The bounding box of the polyline. | |
float | cachedLength |
The length of the polyline. | |
float * | lengths |
Cached lengths for each point. | |
float * | percents |
Cached percentages for each point. | |
BOOL | cacheValid |
Indicates if the cache is valid. | |
Additional Inherited Members | |
![]() | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e) |
Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. | |
static UtilExport void * | operator new (size_t size, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. | |
static UtilExport void * | operator new (size_t size, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. | |
static UtilExport void * | operator new[] (size_t size) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. | |
static UtilExport void * | operator new[] (size_t size, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. | |
static UtilExport void * | operator new[] (size_t size, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. | |
static UtilExport void | operator delete (void *ptr) |
Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. | |
static UtilExport void | operator delete (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. | |
static UtilExport void | operator delete (void *ptr, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. | |
static UtilExport void | operator delete[] (void *ptr) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. | |
static UtilExport void | operator delete[] (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete[] (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. | |
static UtilExport void | operator delete[] (void *ptr, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. | |
static UtilExport void * | operator new (size_t size, void *placement_ptr) |
Placement new operator. | |
static UtilExport void | operator delete (void *ptr, void *placement_ptr) |
Placement delete operator. | |
static UtilExport void * | aligned_malloc (size_t size, size_t alignment) |
Allocates memory on a specified alignment boundary. | |
static UtilExport void * | aligned_realloc (void *ptr, size_t size, size_t alignment) |
Reallocates memory on a specified alignment boundary. | |
static UtilExport void | aligned_free (void *ptr) |
Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. | |
Describes a single polygon in a PolyShape using linear segments.
All methods of this class are implemented by the system.
CoreExport PolyLine | ( | ) |
Constructor.
The number of points is set to zero, the points array is set to NULL, the flags are set to 0, the cache validity is set to FALSE and the bounding box is set to empty.
CoreExport PolyLine | ( | const PolyLine & | from | ) |
Constructor.
The PolyLine is initialized using the input object "from".
CoreExport ~PolyLine | ( | ) |
Destructor.
The array of points is freed.
CoreExport void Init | ( | ) |
Initializes the PolyLine.
The array of points (pts) is freed, the number of points is set to 0, and the cache validity is set to FALSE.
|
inline |
Marks the polyline as closed by setting the POLYLINE_CLOSED flag to one.
CoreExport BOOL IsClosed | ( | ) | const |
Tells if the polyline is closed or not.
|
inline |
Marks the polyline as open by resetting the POLYLINE_CLOSED flag to zero.
CoreExport BOOL IsOpen | ( | ) | const |
Tells if the polyline is open or not.
|
inline |
Sets the POLYLINE_NO_SELF_INT flag.
|
inline |
Returns true if the POLYLINE_NO_SELF_INT flag is set, false if it is not.
CoreExport BOOL SurroundsPoint | ( | Point2 & | point | ) |
Returns TRUE if the specified point is surrounded (contained within) this PolyLine.
This method should only be called on closed PolyLines.
point | The point to check if it is inside the polyline or not. |
|
inline |
Returns the number of vertices (points) in the polyline.
CoreExport int Segments | ( | ) | const |
Returns the number of segments (edges between vertices) of the polyline.
CoreExport BOOL SetNumPts | ( | int | count, |
BOOL | keep = TRUE |
||
) |
Sets the number of points in the polyline.
count | The number to set. |
keep | If set to true, any existing points are copied to the new array. If not, they are freed. Defaults to true. |
CoreExport void Append | ( | const PolyPt & | p | ) |
Appends the specified point to the polyline.
This adds the point to the end of the points list.
p | The point to appended. |
CoreExport void Insert | ( | int | where, |
const PolyPt & | p | ||
) |
Inserts the specified point at the location passed.
where | The "pts" array index indicating where to insert the point. |
p | The point to insert. |
CoreExport void Delete | ( | int | where | ) |
Deletes the specified point.
where | The "pts" array index indicating which point to delete. |
CoreExport void Reverse | ( | BOOL | keepZero = FALSE | ) |
Reverses the order of the points in the polyline.
keepZero | Defaults to false. This should normally be passed as TRUE. If TRUE, and the polyline is closed, this method will make sure that vertex zero is the same on the reversed version as on the non-reversed version. Otherwise if passed as FALSE the last vertex becomes the first vertex, and the first vertex becomes the last. This is an important distinction for the lofter because it always wants vertex zero to be in the same place. |
CoreExport PolyLine & operator= | ( | const PolyLine & | from | ) |
Assignment operator.
CoreExport PolyLine & operator= | ( | Spline3D & | from | ) |
Assignment operator.
This generates a polyline from the spline.
|
inline |
|
inline |
CoreExport void BuildBoundingBox | ( | void | ) |
Computes the bounding box of the polyline.
The result is stored in the bdgBox data member.
CoreExport void InvalidateGeomCache | ( | ) |
Ensures that the calling PolyLine object has flushed out any cached data it may have had.
This resets the bounding box size and sets the cache validity to false. This should be called when any points have been changed in the polyline.
CoreExport Box3 GetBoundingBox | ( | Matrix3 * | tm = NULL | ) |
Returns the bound box of the polyline.
The optional TM allows the box to be calculated in any space.
tm | The points of the polyline are multiplied by this matrix before the box computation. Defaults to NULL. |
CoreExport void Render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
RECT * | rp, | ||
int | compFlags, | ||
int | numMat | ||
) |
This method is used internally.
CoreExport void Render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
int | numMat, | ||
BOOL | colorSegs, | ||
BitArray & | segsel, | ||
BOOL | useStartSegments = TRUE |
||
) |
This renders the polyline to the display.
gw | Points to the graphics window to render to. |
ma | The list of materials to use to render the polyline. See Class Material, Class INode - Material methods. |
numMat | The number of materials for the polyline. |
colorSegs | if this is set material is used to determine what colors to render the polyline. Otherwise the standard sel/subsel colors are used |
segsel | this is the segment sel bitarray used to draw the selected segments |
useStartSegments | = TRUE if this is set the start/endsegments will be used around the polyline draw. If you are drawing several polylines in a row it is faster to set this to false and use start/endsegments around the entire draw instead of each individual polyline |
CoreExport BOOL Select | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
HitRegion * | hr, | ||
int | abortOnHit = FALSE |
||
) |
This method is used internally.
CoreExport void Snap | ( | GraphicsWindow * | gw, |
SnapInfo * | snap, | ||
IPoint2 * | p, | ||
Matrix3 & | tm, | ||
DWORD | vflags | ||
) |
This method is used internally.
CoreExport void Transform | ( | const Matrix3 & | tm | ) |
Transforms the points of the polyline by the specified matrix.
tm | The matrix used to transform the points. |
CoreExport void Dump | ( | const MCHAR * | title = NULL | ) |
Called to dump the polyline structure via DebugPrint().
See ~{ Troubleshooting }~.
title | This title string is displayed using a DebugPrint() before the rest of the data. |
CoreExport void SpliceLine | ( | int | where, |
PolyLine & | source, | ||
int | splicePoint | ||
) |
This method is used internally as part of the capping mechanism and should not be used.
CoreExport BOOL HitsSegment | ( | Point2 | p1, |
Point2 | p2, | ||
BOOL | findAll = FALSE , |
||
IntersectionCallback3D * | cb = nullptr |
||
) |
Tells if the line segment defined between the two input points intersects this PolyLine object or not.
p1,p2 | The endpoints of the line to check. |
findAll | TRUE to find all intersections. FALSE to find only the first intersection. Defaults to FALSE. |
cb | A pointer to an IntersectionCallback3D class. Defaults to nullptr. If a non-null callback is supplied, the callback will be called for each intersection with the 'p' argument indicating the intersection point; 'piece1' will indicate the index of the segment on this PolyLine involved in the intersection and 'piece2' will be -1. |
CoreExport int Cap3DS | ( | CapVert * | capverts, |
MeshCapInfo & | capInfo, | ||
DWORD | options = 0 |
||
) |
This method is used internally.
CoreExport BOOL HitsPolyLine | ( | PolyLine & | line, |
BOOL | findAll = FALSE , |
||
IntersectionCallback3D * | cb = nullptr |
||
) |
Tells if the input PolyLine intersects this PolyLine or not.
line | The input PolyLine to check. |
findAll | TRUE to find all intersections. FALSE to find only the first intersection. |
cb | A pointer to an IntersectionCallback3D class. Defaults to nullptr. If a non-null callback is supplied, the callback will be called for each intersection with the 'p' argument indicating the intersection point; 'piece1' will indicate the index of the segment in 'line' which intersects and 'piece2' will indicate the index of the segment in this PolyLine which intersects 'line'. |
CoreExport Point3 InterpPiece3D | ( | int | segment, |
float | t | ||
) |
Returns a point interpolated on a segment between two points.
segment | The index of the segment to interpolate. |
t | A value in the range of 0.0 to 1.0. 0 is the first point and 1 is the second point. |
CoreExport Point3 InterpCurve3D | ( | float | u, |
int | ptype = POLYSHP_INTERP_SIMPLE |
||
) |
Returns a point interpolated on the entire curve.
This method returns a point but does not tell on which segment the point falls.
u | A value in the range of 0.0 to 1.0 for the entire curve. |
ptype | The parameter type for interpolation. The default value, POLYSHP_INTERP_SIMPLE, is based on segments (rather than the entire curve). See Parameter types for shape interpolation |
CoreExport Point3 TangentPiece3D | ( | int | segment, |
float | t | ||
) |
Returns a tangent vector interpolated on a segment between two points.
segment | The index of the segment. |
t | A value in the range of 0.0 to 1.0. 0 is the first point and 1 is the second point. |
CoreExport Point3 TangentCurve3D | ( | float | u, |
int | ptype = POLYSHP_INTERP_SIMPLE |
||
) |
Returns a tangent vector interpolated on the entire curve.
u | A value in the range of 0.0 to 1.0 for the entire curve. |
ptype | The parameter type for interpolation. The default value, POLYSHP_INTERP_SIMPLE, is based on segments (rather than the entire curve). See Parameter types for shape interpolation |
CoreExport MtlID GetMatID | ( | int | segment | ) |
Returns the material ID for the specified segment.
segment | The zero based index of the segment. |
CoreExport float CurveLength | ( | ) |
Returns the length of the calling PolyLine object.
CoreExport BOOL IsClockWise | ( | ) |
Returns true if the polyline is clockwise in the XY plane (ignoring the Z dimension), false otherwise.
If the calling PolyLine object self intersects, the result is meaningless.
CoreExport BOOL SelfIntersects | ( | BOOL | findAll = FALSE , |
IntersectionCallback3D * | cb = nullptr |
||
) |
Returns TRUE if the polyline intersects itself in the XY plane (ignoring the Z dimension), false otherwise.
findAll | TRUE to find all self intersections, FALSE to find only the first self intersection. Defaults to FALSE. |
cb | Pointer to an IntersectionCallback3D class. Defaults to nullptr. If a non-null callback is supplied, the callback will be called for each intersection with the 'p' argument indicating the intersection point; 'piece1' and 'piece2' will indicate the indices of the two segments in the PolyLine which intersect. |
CoreExport void GetSmoothingMap | ( | IntTab & | map | ) |
CoreExport IOResult Save | ( | ISave * | isave | ) |
CoreExport IOResult Load | ( | ILoad * | iload | ) |
CoreExport void Swap | ( | PolyLine & | line | ) |
Lets the developer transfer the content of a line object to another object without suffering from any copy penalties.
This is useful to transfer polylines to a new array, for instance.
[in,out] | line | PolLine object to swap with. |
int numPts |
The number of points in the polyline.
PolyPt* pts |
Pointer to the actual points in the polyline.
DWORD flags |
See PolyLine Flags.
Box3 bdgBox |
The bounding box of the polyline.
float cachedLength |
The length of the polyline.
float* lengths |
Cached lengths for each point.
float* percents |
Cached percentages for each point.
BOOL cacheValid |
Indicates if the cache is valid.