Panda3D
Public Member Functions | Static Public Member Functions

ParametricCurveCollection Class Reference

This is a set of zero or more ParametricCurves, which may or may not be related. More...

Inheritance diagram for ParametricCurveCollection:
ReferenceCount MemoryBase

List of all members.

Public Member Functions

 ParametricCurveCollection ()
 addCurve (ParametricCurve curve)
 Adds a new ParametricCurve to the collection.
 addCurve (ParametricCurve curve, int index)
 Adds a new ParametricCurve to the collection at the indicated index.
int addCurves (PandaNode node)
 Adds all the curves found in the scene graph rooted at the given node.
bool adjustHpr (float t, VBase3 const xyz)
 Adjust the HPR curve at the indicated time to the new value.
bool adjustHpr (float t, float h, float p, float r)
 Adjust the HPR curve at the indicated time to the new value.
bool adjustXyz (float t, VBase3 const xyz)
 Adjust the XYZ curve at the indicated time to the new value.
bool adjustXyz (float t, float x, float y, float z)
 Adjust the XYZ curve at the indicated time to the new value.
 clear ()
 Removes all ParametricCurves from the collection.
 clearTimewarps ()
 Removes all the timewarp curves from the collection.
bool evaluate (float t, Mat4 result, CoordinateSystem cs)
 Computes the transform matrix representing translation to the position indicated by the first XYZ curve in the collection and the rotation indicated by the first HPR curve in the collection, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.
bool evaluate (float t, Mat4 result)
 Computes the transform matrix representing translation to the position indicated by the first XYZ curve in the collection and the rotation indicated by the first HPR curve in the collection, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.
bool evaluate (float t, VBase3 xyz, VBase3 hpr)
 Computes the position and rotation represented by the first XYZ and HPR curves in the collection at the given point t, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.
bool evaluateHpr (float t, VBase3 hpr)
 Computes only the HPR part of the curves.
float evaluateT (float t)
 Determines the value of t that should be passed to the XYZ and HPR curves, after applying the given value of t to all the timewarps.
bool evaluateXyz (float t, VBase3 xyz)
 Computes only the XYZ part of the curves.
 faceForward (float segments_per_unit)
 Discards the existing HPR curve and generates a new one that looks in the direction of travel along the XYZ curve, based on the XYZ curve's tangent at each point.
ParametricCurve getCurve (int index)
 Returns the nth ParametricCurve in the collection.
list getCurves ()
ParametricCurve getDefaultCurve ()
 If there is an XYZ curve in the collection, returns it; otherwise, returns the first curve whose type is unspecified.
ParametricCurve getHprCurve ()
 Returns the first HPR curve in the collection, if any, or NULL if there are none.
float getMaxT ()
 Returns the maximum T value associated with the last* curve in the collection.
int getNumCurves ()
 Returns the number of ParametricCurves in the collection.
int getNumTimewarps ()
 Returns the number of timewarp curves in the collection.
int getRefCount ()
 Returns the current reference count.
ParametricCurve getTimewarpCurve (int n)
 Returns the nth timewarp curve in the collection.
list getTimewarpCurves ()
ParametricCurve getXyzCurve ()
 Returns the first XYZ curve in the collection, if any, or NULL if there are none.
bool hasCurve (ParametricCurve curve)
 Returns true if the indicated ParametricCurve appears in this collection, false otherwise.
 makeEven (float max_t, float segments_per_unit)
 Discards all existing timewarp curves and recomputes a new timewarp curve that maps distance along the curve to parametric time, so that the distance between any two points in parametric time is proportional to the approximate distance of those same two points along the XYZ curve.
 output (ostream out)
 Writes a brief one-line description of the ParametricCurveCollection to the indicated output stream.
bool recompute ()
 Ensures all the curves are freshly computed and up-to-date.
 ref ()
 Explicitly increments the reference count.
bool removeCurve (ParametricCurve curve)
 Removes the indicated ParametricCurve from the collection.
 removeCurve (int index)
 Removes the indicated ParametricCurve from the collection, by its index number.
 resetMaxT (float max_t)
 Adjusts the apparent length of the curve by applying a new timewarp that maps the range [0..max_t] to the range [0..get_max_t()].
bool stitch (ParametricCurveCollection const a, ParametricCurveCollection const b)
 Regenerates this curve as one long curve: the first curve connected end-to-end with the second one.
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool unref ()
 Explicitly decrements the reference count.
 write (ostream out, int indent_level)
 Writes a complete multi-line description of the ParametricCurveCollection to the indicated output stream.
 write (ostream out)
 Writes a complete multi-line description of the ParametricCurveCollection to the indicated output stream.
bool writeEgg (ostream out, Filename const filename, CoordinateSystem cs)
 Writes an egg description of all the nurbs curves in the collection to the specified output stream.
bool writeEgg (Filename filename, CoordinateSystem cs)
 Writes an egg description of all the nurbs curves in the collection to the specified output file.
bool writeEgg (Filename filename)
 Writes an egg description of all the nurbs curves in the collection to the specified output file.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

This is a set of zero or more ParametricCurves, which may or may not be related.

If they are related, the set should contain no more than one XYZ curve, no more than one HPR curve, and zero or more Timewarp curves, which can then be evaluated as a unit to return a single transformation matrix for a given unit of time.


Constructor & Destructor Documentation


Member Function Documentation

addCurve ( ParametricCurve  curve)

Adds a new ParametricCurve to the collection.

addCurve ( ParametricCurve  curve,
int  index 
)

Adds a new ParametricCurve to the collection at the indicated index.

int addCurves ( PandaNode  node)

Adds all the curves found in the scene graph rooted at the given node.

Returns the number of curves found.

bool adjustHpr ( float  t,
VBase3 const  xyz 
)

Adjust the HPR curve at the indicated time to the new value.

The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

bool adjustHpr ( float  t,
float  h,
float  p,
float  r 
)

Adjust the HPR curve at the indicated time to the new value.

The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

bool adjustXyz ( float  t,
VBase3 const  xyz 
)

Adjust the XYZ curve at the indicated time to the new value.

The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

bool adjustXyz ( float  t,
float  x,
float  y,
float  z 
)

Adjust the XYZ curve at the indicated time to the new value.

The curve shape will change correspondingly. Returns true if successful, false if unable to make the adjustment for some reason.

clear ( )

Removes all ParametricCurves from the collection.

clearTimewarps ( )

Removes all the timewarp curves from the collection.

bool evaluate ( float  t,
Mat4  result,
CoordinateSystem  cs 
)

Computes the transform matrix representing translation to the position indicated by the first XYZ curve in the collection and the rotation indicated by the first HPR curve in the collection, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.

Returns true if the point is valid (i.e. t is within the bounds indicated by all the timewarp curves and within the bounds of the curves themselves), or false otherwise.

bool evaluate ( float  t,
Mat4  result 
)

Computes the transform matrix representing translation to the position indicated by the first XYZ curve in the collection and the rotation indicated by the first HPR curve in the collection, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.

Returns true if the point is valid (i.e. t is within the bounds indicated by all the timewarp curves and within the bounds of the curves themselves), or false otherwise.

bool evaluate ( float  t,
VBase3  xyz,
VBase3  hpr 
)

Computes the position and rotation represented by the first XYZ and HPR curves in the collection at the given point t, after t has been modified by all the timewarp curves in the collection applied in sequence, from back to front.

Returns true if the point is valid (i.e. t is within the bounds indicated by all the timewarp curves and within the bounds of the curves themselves), or false otherwise.

bool evaluateHpr ( float  t,
VBase3  hpr 
)

Computes only the HPR part of the curves.

See evaluate().

float evaluateT ( float  t)

Determines the value of t that should be passed to the XYZ and HPR curves, after applying the given value of t to all the timewarps.

Return -1.0f if the value of t exceeds one of the timewarps' ranges.

bool evaluateXyz ( float  t,
VBase3  xyz 
)

Computes only the XYZ part of the curves.

See evaluate().

faceForward ( float  segments_per_unit)

Discards the existing HPR curve and generates a new one that looks in the direction of travel along the XYZ curve, based on the XYZ curve's tangent at each point.

static TypeHandle getClassType ( ) [static, inherited]

Reimplemented in NodeReferenceCount, TypedReferenceCount, VirtualFile, VirtualFileComposite, VirtualFileMount, VirtualFileMountMultifile, VirtualFileMountSystem, VirtualFileSimple, HTTPChannel, VirtualFileHTTP, VirtualFileMountHTTP, VrpnClient, ClientBase, PGItem, PandaNode, PGButton, PGTop, PGEntry, PGMouseWatcherBackground, MouseWatcherRegion, PGMouseWatcherParameter, TypedWritableReferenceCount, PGVirtualFrame, PGSliderBar, PGScrollFrame, PGWaitBar, FilterProperties, AudioSound, AudioManager, BamCacheRecord, CallbackObject, CachedTypedWritableReferenceCount, ClockObject, CopyOnWriteObject, NodeCachedReferenceCount, PythonCallbackObject, LerpFunctor, IntLerpFunctor, FloatLerpFunctor, SimpleLerpFunctorPoint2, SimpleLerpFunctorPoint3, SimpleLerpFunctorPoint4, SimpleLerpFunctorVBase2, SimpleLerpFunctorVBase3, SimpleLerpFunctorVBase4, SimpleLerpFunctorVec2, SimpleLerpFunctorVec3, SimpleLerpFunctorVec4, IntQueryLerpFunctor, FloatQueryLerpFunctor, SimpleQueryLerpFunctorPoint2, SimpleQueryLerpFunctorPoint3, SimpleQueryLerpFunctorPoint4, SimpleQueryLerpFunctorVBase2, SimpleQueryLerpFunctorVBase3, SimpleQueryLerpFunctorVBase4, SimpleQueryLerpFunctorVec2, SimpleQueryLerpFunctorVec3, SimpleQueryLerpFunctorVec4, MultiLerpFunctor, LerpBlendType, EaseInBlendType, EaseOutBlendType, EaseInOutBlendType, NoBlendType, Lerp, AutonomousLerp, ButtonThrower, DataNode, MouseInterfaceNode, DriveInterface, MouseSubregion, MouseWatcherGroup, MouseWatcher, Trackball, Transform2SG, TextFont, DynamicTextPage, Texture, DynamicTextFont, GeomTextGlyph, Geom, StaticTextFont, TextNode, ParametricCurve, CubicCurveseg, PiecewiseCurve, HermiteCurve, NurbsCurve, RopeNode, SheetNode, BoundingVolume, GeometricBoundingVolume, FiniteBoundingVolume, BoundingBox, BoundingHexahedron, BoundingLine, BoundingPlane, BoundingSphere, OmniBoundingVolume, DisplayRegionBase, GraphicsOutputBase, GraphicsStateGuardianBase, InternalName, GeomVertexArrayFormat, GeomVertexFormat, GeomVertexArrayData, GeomVertexArrayDataHandle, VertexTransform, TransformTable, TransformBlendTable, VertexSlider, SliderTable, GeomVertexData, AnimateVerticesRequest, AsyncTask, GeomPrimitive, TextureStage, GeomLines, GeomLinestrips, GeomPoints, GeomTriangles, GeomTrifans, GeomTristrips, Material, Lens, OrthographicLens, MatrixLens, PerspectiveLens, Shader, TextureReloadRequest, UserVertexSlider, UserVertexTransform, VideoTexture, AsyncTaskBase, AsyncTaskChain, AsyncTaskManager, AsyncTaskPause, AsyncTaskSequence, EventStoreValueBase, EventStoreTypedRefCount, Event, PointerEventList, PythonTask, Thread, ExternalThread, MainThread, PythonThread, WindowHandle.OSHandle, WindowHandle, OSHandle, DisplayRegion, GraphicsDevice, GraphicsPipe, GraphicsStateGuardian, StereoDisplayRegion, GraphicsOutput, GraphicsBuffer, GraphicsWindow, NativeWindowHandle, ParasiteBuffer, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, CollisionHandler, CollisionSolid, CollisionNode, CollisionEntry, CollisionHandlerEvent, CollisionHandlerHighestEvent, CollisionHandlerPhysical, CollisionHandlerFloor, CollisionHandlerGravity, CollisionHandlerPusher, CollisionHandlerFluidPusher, CollisionHandlerQueue, CollisionDSSolid, CollisionBox, CollisionSphere, CollisionInvSphere, CollisionRay, CollisionLine, CollisionPlane, CollisionPolygon, CollisionParabola, CollisionFloorMesh, CollisionSegment, CollisionTube, CollisionVisualizer, CharacterJoint, MovingPartMatrix, CharacterSlider, MovingPartScalar, CharacterVertexSlider, JointVertexTransform, Character, PartBundleNode, CharacterJointBundle, PartBundle, CharacterJointEffect, RenderEffect, AnimGroup, AnimBundle, AnimBundleNode, PartGroup, AnimControl, AnimChannelBase, AnimChannelACMatrixSwitchType, AnimChannelACScalarSwitchType, AnimChannelMatrixDynamic, AnimChannelMatrixXfmTable, AnimChannelScalarDynamic, AnimChannelScalarTable, AnimPreloadTable, BindAnimRequest, ModelLoadRequest, MovingPartBase, MovingPartACMatrixSwitchType, MovingPartACScalarSwitchType, FFMpegTexture, FrameRateMeter, SceneGraphAnalyzerMeter, MovieTexture, NodeVertexTransform, RigidBodyCombiner, PipeOcclusionCullTraverser, CullTraverser, MovieVideo, MovieVideoCursor, MovieAudio, MovieAudioCursor, InkblotVideo, InkblotVideoCursor, FfmpegVideo, FfmpegVideoCursor, FfmpegAudio, FfmpegAudioCursor, MicrophoneAudio, UserDataAudio, UserDataAudioCursor, TransformState, RenderAttrib, RenderModeAttrib, TexMatrixAttrib, RenderState, AlphaTestAttrib, AntialiasAttrib, RenderEffects, TransparencyAttrib, AudioVolumeAttrib, AuxBitplaneAttrib, AuxSceneData, BillboardEffect, LensNode, Camera, PlaneNode, ClipPlaneAttrib, ColorAttrib, ColorBlendAttrib, ColorScaleAttrib, ColorWriteAttrib, CompassEffect, CullBinAttrib, CullFaceAttrib, GeomNode, DecalEffect, DepthOffsetAttrib, DepthTestAttrib, DepthWriteAttrib, EventStorePandaNode, Fog, FogAttrib, Light, LightAttrib, LightRampAttrib, PandaLoader, MaterialAttrib, ModelFlattenRequest, ModelNode, ModelRoot, TextureAttrib, TexGenAttrib, PolylightNode, PolylightEffect, ShaderInput, ShaderAttrib, ShowBoundsEffect, TexProjectorEffect, ScissorEffect, PosLerpFunctor, HprLerpFunctor, ScaleLerpFunctor, ColorLerpFunctor, PosHprLerpFunctor, HprScaleLerpFunctor, PosHprScaleLerpFunctor, ColorScaleLerpFunctor, PortalNode, RescaleNormalAttrib, ScissorAttrib, ShadeModelAttrib, StencilAttrib, UvScrollNode, LightNode, AmbientLight, CallbackNode, LightLensNode, DirectionalLight, LODNode, FadeLODNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, RecorderBase, MouseRecorder, RecorderController, and SocketStreamRecorder.

ParametricCurve getCurve ( int  index)

Returns the nth ParametricCurve in the collection.

list getCurves ( )
ParametricCurve getDefaultCurve ( )

If there is an XYZ curve in the collection, returns it; otherwise, returns the first curve whose type is unspecified.

Returns NULL if no curve meets the criteria.

ParametricCurve getHprCurve ( )

Returns the first HPR curve in the collection, if any, or NULL if there are none.

float getMaxT ( )

Returns the maximum T value associated with the last* curve in the collection.

Normally, this will be either the XYZ or HPR curve, or a timewarp curve.

int getNumCurves ( )

Returns the number of ParametricCurves in the collection.

int getNumTimewarps ( )

Returns the number of timewarp curves in the collection.

int getRefCount ( ) [inherited]

Returns the current reference count.

ParametricCurve getTimewarpCurve ( int  n)

Returns the nth timewarp curve in the collection.

list getTimewarpCurves ( )
ParametricCurve getXyzCurve ( )

Returns the first XYZ curve in the collection, if any, or NULL if there are none.

bool hasCurve ( ParametricCurve  curve)

Returns true if the indicated ParametricCurve appears in this collection, false otherwise.

makeEven ( float  max_t,
float  segments_per_unit 
)

Discards all existing timewarp curves and recomputes a new timewarp curve that maps distance along the curve to parametric time, so that the distance between any two points in parametric time is proportional to the approximate distance of those same two points along the XYZ curve.

segments_per_unit represents the number of segments to take per each unit of parametric time of the original XYZ curve.

The new timewarp curve (and thus, the apparent range of the collection) will range from 0 to max_t.

output ( ostream  out)

Writes a brief one-line description of the ParametricCurveCollection to the indicated output stream.

bool recompute ( )

Ensures all the curves are freshly computed and up-to-date.

Returns true if everything is valid, false if at least one curve is incorrect.

ref ( ) [inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

bool removeCurve ( ParametricCurve  curve)

Removes the indicated ParametricCurve from the collection.

Returns true if the curve was removed, false if it was not a member of the collection.

removeCurve ( int  index)

Removes the indicated ParametricCurve from the collection, by its index number.

resetMaxT ( float  max_t)

Adjusts the apparent length of the curve by applying a new timewarp that maps the range [0..max_t] to the range [0..get_max_t()].

After this call, the curve collection will contain one more timewarp curve, and get_max_t() will return the given max_t value.

bool stitch ( ParametricCurveCollection const  a,
ParametricCurveCollection const  b 
)

Regenerates this curve as one long curve: the first curve connected end-to-end with the second one.

Either a or b may be the same as 'this'. This will lose any timewarps on the input curves.

Returns true if successful, false on failure.

bool testRefCountIntegrity ( ) [inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

bool testRefCountNonzero ( ) [inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

bool unref ( ) [inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.

write ( ostream  out)

Writes a complete multi-line description of the ParametricCurveCollection to the indicated output stream.

write ( ostream  out,
int  indent_level 
)

Writes a complete multi-line description of the ParametricCurveCollection to the indicated output stream.

bool writeEgg ( Filename  filename,
CoordinateSystem  cs 
)

Writes an egg description of all the nurbs curves in the collection to the specified output file.

Returns true if the file is successfully written.

bool writeEgg ( Filename  filename)

Writes an egg description of all the nurbs curves in the collection to the specified output file.

Returns true if the file is successfully written.

bool writeEgg ( ostream  out,
Filename const  filename,
CoordinateSystem  cs 
)

Writes an egg description of all the nurbs curves in the collection to the specified output stream.

Returns true if the file is successfully written.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties