3ds Max C++ API Reference
Loading...
Searching...
No Matches
spline3d.h File Reference
#include "maxheap.h"
#include "polyshp.h"
#include "GraphicsConstants.h"
#include "Util/CountedObject.h"

Classes

class  SplinePoint
 Provides the vertex-level point information for the Spline3D class. More...
 
class  SplineKnotAssy
 Used for the internal storage of spline knot assemblies in the Spline3D class. More...
 
class  SplineKnot
 Describes a single knot in a spline. More...
 
class  Spline3D
 General-purpose 3D spline class. More...
 

Macros

#define BEZ_SHAPE_KNOT   (1<<0)
 A knot point.
 
#define BEZ_SHAPE_INTERPOLATED   (1<<1)
 An interpolated point between two knots.
 
#define LTYPE_CURVE   0
 Specifies that the segment should interpolate based on the bezier handles for the segment.
 
#define LTYPE_LINE   1
 Specifies that the segment should go straight from knot to knot and ignore the bezier handles.
 
#define CURVE_CURVE   (LTYPE_CURVE | (LTYPE_CURVE<<2))
 
#define LINE_CURVE   (LTYPE_LINE | (LTYPE_CURVE<<2))
 
#define CURVE_LINE   (LTYPE_CURVE | (LTYPE_LINE<<2))
 
#define LINE_LINE   (LTYPE_LINE | (LTYPE_LINE<<2))
 
#define KTYPE_AUTO   0
 Produces the bezier handles automatically to produce a smooth curve.
 
#define KTYPE_CORNER   1
 Produces a sharp corner.
 
#define KTYPE_BEZIER   2
 This knot type produces bezier handles that are collinear (the bezier vectors coming out of the knot are collinear).
 
#define KTYPE_BEZIER_CORNER   (KTYPE_BEZIER | KTYPE_CORNER)
 This knot type has bezier handles but they are not constrained to be opposite each other.
 
#define KTYPE_RESET   4
 
#define PARM_UNIFORM   0
 
#define PARM_ARCLENGTH   1
 
#define PARM_CENTRIPETAL   2
 
#define PARM_CUSTOM   3
 
#define DRAW_IDLE   0
 
#define DRAW_INITIAL_MOUSE_DOWN   1
 
#define DRAW_FREEMOVE_POINT   2
 
#define DRAW_FREEMOVE_POINT_MOUSE_DOWN   3
 Inserting's initial click inside spline.
 
#define DRAW_INITIAL_BEZ_ADJ   11
 
#define DRAW_DRAGGING_VECTOR   22
 
#define SPLINE_INTERP_SIMPLE   0
 Parameter space based on segments.
 
#define SPLINE_INTERP_NORMALIZED   1
 Parameter space normalized to curve length.
 
#define SPLINE_MATID_SHIFT   16
 The mat ID is stored in the HIWORD of the knot flags.
 
#define SPLINE_MATID_MASK   0xFFFF
 The mat ID is stored in the HIWORD of the knot flags.
 
#define SEGMENT_VISIBLE   (1<<0)
 
#define SPLINEKNOT_NO_SNAP   (1<<1)
 Suppresses snapping to knot if set.
 
#define SPLINEKNOT_ADD_SEL   (1<<2)
 Primarily for internal use, and is designed for the new "connect copy" feature of spline segments.
 
#define SPLINEKNOT_USER1   (1 << 8)
 Developer-defined knot flags Flag bits 8-15 are reserved for use by developers.
 
#define SPLINEKNOT_USER2   (1 << 9)
 
#define SPLINEKNOT_USER3   (1 << 10)
 
#define SPLINEKNOT_USER4   (1 << 11)
 
#define SPLINEKNOT_USER5   (1 << 12)
 
#define SPLINEKNOT_USER6   (1 << 13)
 
#define SPLINEKNOT_USER7   (1 << 14)
 
#define SPLINEKNOT_USER8   (1 << 15)
 
#define SPLINEKNOT_USERFLAGS   (SPLINEKNOT_USER1 | SPLINEKNOT_USER2 | SPLINEKNOT_USER3 | SPLINEKNOT_USER4 | SPLINEKNOT_USER5 | SPLINEKNOT_USER6 | SPLINEKNOT_USER7 | SPLINEKNOT_USER8)
 
#define SPLINE_CLOSED   (1<<0)
 
#define SPLINE_ORTHOG   (1<<1)
 
#define SPLINE_COMPUTE_BEZ_IN_USE   (1<<2)
 
#define SPLINE_INITIAL_TYPE_INDEX   -1
 Beginning with 2024.1, the following special values may be supplied to SetKnotType as the 'index' value in order to set the Spline3D's 'initialType' and 'dragType' knot type values.
 
#define SPLINE_DRAG_TYPE_INDEX   -2
 Knot type at drag.
 

Functions

CoreExport bool IsSplineSegmentEffectivelyLinear (Spline3D *spline, int segment, float linearTolerance=0.01f)
 This function checks to see if a given segment of a spline is effectively linear.
 

Macro Definition Documentation

◆ SPLINE_MATID_SHIFT

#define SPLINE_MATID_SHIFT   16

The mat ID is stored in the HIWORD of the knot flags.

◆ SPLINE_MATID_MASK

#define SPLINE_MATID_MASK   0xFFFF

The mat ID is stored in the HIWORD of the knot flags.

◆ SEGMENT_VISIBLE

#define SEGMENT_VISIBLE   (1<<0)

◆ SPLINEKNOT_NO_SNAP

#define SPLINEKNOT_NO_SNAP   (1<<1)

Suppresses snapping to knot if set.

◆ SPLINEKNOT_ADD_SEL

#define SPLINEKNOT_ADD_SEL   (1<<2)

Primarily for internal use, and is designed for the new "connect copy" feature of spline segments.

The method XFormVerts() normally operates on the selected knots (or the knots of selected spline segments), but if the knots have the SPLINEKNOT_ADD_SEL flag set, and the SplineShape also has the ES_ADDED_SELECT flag set, then those additional knots will be affected as well. Additional selection for transformation

◆ SPLINEKNOT_USER1

#define SPLINEKNOT_USER1   (1 << 8)

Developer-defined knot flags Flag bits 8-15 are reserved for use by developers.

These bits should only be used temporarily, since other developers may also use them for other purposes.

◆ SPLINEKNOT_USER2

#define SPLINEKNOT_USER2   (1 << 9)

◆ SPLINEKNOT_USER3

#define SPLINEKNOT_USER3   (1 << 10)

◆ SPLINEKNOT_USER4

#define SPLINEKNOT_USER4   (1 << 11)

◆ SPLINEKNOT_USER5

#define SPLINEKNOT_USER5   (1 << 12)

◆ SPLINEKNOT_USER6

#define SPLINEKNOT_USER6   (1 << 13)

◆ SPLINEKNOT_USER7

#define SPLINEKNOT_USER7   (1 << 14)

◆ SPLINEKNOT_USER8

#define SPLINEKNOT_USER8   (1 << 15)

◆ SPLINEKNOT_USERFLAGS

◆ SPLINE_INITIAL_TYPE_INDEX

#define SPLINE_INITIAL_TYPE_INDEX   -1

Beginning with 2024.1, the following special values may be supplied to SetKnotType as the 'index' value in order to set the Spline3D's 'initialType' and 'dragType' knot type values.

These are used in the Create Line and Insert operations for all new knots in Edit and Editable Spline, and were previously only settable in the Spline3D constructor. Knot type at initial click.

◆ SPLINE_DRAG_TYPE_INDEX

#define SPLINE_DRAG_TYPE_INDEX   -2

Knot type at drag.

Function Documentation

◆ IsSplineSegmentEffectivelyLinear()

CoreExport bool IsSplineSegmentEffectivelyLinear ( Spline3D spline,
int  segment,
float  linearTolerance = 0.01f 
)

This function checks to see if a given segment of a spline is effectively linear.

If the segment itself is LTYPE_LINEAR, both knots of the segment are KTYPE_CORNER, have zero-length Bezier vectors, or the Bezier vectors of both segment knots point directly at the other knot (or any combination of the above), the segment is considered to be effectively linear. 'linearTolerance' is a tolerance value that is used to determine if the Bezier vectors point directly at the other knot. Given a knot point K1 with its bezier vector KV and another knot point K2, if the value: Length(Normalize(KV-K1) - Normalize(K2-K1)) < linearTolerance, the vector is considered to be effectively linear.

Parameters
splineThe spline to check.
segmentThe segment index to check.
linearToleranceA tolerance value that is used to determine if the Bezier vectors point directly at the other knot. Given a knot point K1 with its Bezier vector KV and another knot point K2, if the value: Length(Normalize(KV-K1) - Normalize(K2-K1)) < linearTolerance, the vector is considered to be effectively linear.
Returns
true if the segment is effectively linear; false otherwise.