Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions
CollisionSegment Class Reference

A finite line segment, with two specific endpoints but no thickness. More...

Inheritance diagram for CollisionSegment:
CollisionSolid CopyOnWriteObject CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

List of all members.

Public Member Functions

 CollisionSegment ()
 Creates an invalid segment.
 CollisionSegment (Point3 const a, Point3 const db)
 CollisionSegment (float ax, float ay, float az, float bx, float by, float bz)
Point3 const getPointA ()
Point3 const getPointB ()
bool setFromLens (LensNode camera, Point2 const point)
 Accepts a LensNode and a 2-d point in the range [-1,1].
bool setFromLens (LensNode camera, float px, float py)
 Accepts a LensNode and a 2-d point in the range [-1,1].
 setPointA (Point3 const a)
 setPointA (float x, float y, float z)
 setPointB (Point3 const b)
 setPointB (float x, float y, float z)

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

A finite line segment, with two specific endpoints but no thickness.

It's similar to a CollisionRay, except it does not continue to infinity.

It does have an ordering, from point A to point B. If more than a single point of the segment is intersecting a solid, the reported intersection point is generally the closest on the segment to point A.


Constructor & Destructor Documentation

Creates an invalid segment.

This isn't terribly useful; it's expected that the user will subsequently adjust the segment via set_origin()/set_direction() or set_from_lens().

CollisionSegment ( Point3 const  a,
Point3 const  db 
)
CollisionSegment ( float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz 
)

Member Function Documentation

static TypeHandle getClassType ( ) [static]

Reimplemented from CollisionSolid.

Point3 const getPointA ( )
Point3 const getPointB ( )
bool setFromLens ( LensNode  camera,
Point2 const  point 
)

Accepts a LensNode and a 2-d point in the range [-1,1].

Sets the CollisionSegment so that it begins at the LensNode's near plane and extends to the far plane, making it suitable for picking objects from the screen given a camera and a mouse location.

Returns true if the point was acceptable, false otherwise.

bool setFromLens ( LensNode  camera,
float  px,
float  py 
)

Accepts a LensNode and a 2-d point in the range [-1,1].

Sets the CollisionSegment so that it begins at the LensNode's near plane and extends to the far plane, making it suitable for picking objects from the screen given a camera and a mouse location.

setPointA ( Point3 const  a)
setPointA ( float  x,
float  y,
float  z 
)
setPointB ( Point3 const  b)
setPointB ( float  x,
float  y,
float  z 
)
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties