30 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
31 INLINE
explicit CollisionBox(
const LPoint3 &min,
const LPoint3 &max);
40 virtual CollisionSolid *make_copy();
44 virtual void xform(
const LMatrix4 &mat);
49 virtual void output(std::ostream &out)
const;
61 INLINE
void set_center(
const LPoint3 ¢er);
62 INLINE
void set_center(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
63 INLINE
const LPoint3 &get_center()
const;
64 INLINE
const LPoint3 &get_min()
const;
65 INLINE
const LPoint3 &get_max()
const;
66 INLINE LVector3 get_dimensions()
const;
69 MAKE_PROPERTY(center, get_center);
70 MAKE_PROPERTY(min, get_min);
71 MAKE_PROPERTY(max, get_max);
72 MAKE_PROPERTY(dimensions, get_dimensions);
89 virtual void fill_viz_geom();
92 bool intersects_line(
double &t1,
double &t2,
93 const LPoint3 &from,
const LVector3 &delta,
94 PN_stdfloat inflate_size=0)
const;
100 PN_stdfloat _x, _y, _z, _radius;
104 static const int plane_def[6][4];
110 INLINE
static bool is_right(
const LVector2 &v1,
const LVector2 &v2);
111 INLINE
static PN_stdfloat dist_to_line(
const LPoint2 &p,
112 const LPoint2 &f,
const LVector2 &v);
113 static PN_stdfloat dist_to_line_segment(
const LPoint2 &p,
114 const LPoint2 &f,
const LPoint2 &t,
120 INLINE PointDef(
const LPoint2 &p,
const LVector2 &v);
121 INLINE PointDef(PN_stdfloat x, PN_stdfloat y);
122 INLINE PointDef(
const PointDef ©);
123 INLINE
void operator = (
const PointDef ©);
128 typedef pvector<PointDef> Points;
132 const Points &points)
const;
135 PN_stdfloat
dist_to_polygon(
const LPoint2 &p,
const Points &points)
const;
137 void setup_points(
const LPoint3 *begin,
const LPoint3 *end,
int plane);
138 INLINE LPoint2
to_2d(
const LVecBase3 &point3d,
int plane)
const;
141 INLINE
static LPoint3
to_3d(
const LVecBase2 &point2d,
const LMatrix4 &to_3d_mat);
142 LPoint3 legacy_to_3d(
const LVecBase2 &point2d,
int axis)
const;
143 bool clip_polygon(Points &new_points,
const Points &source_points,
144 const LPlane &plane,
int plane_no)
const;
150 LMatrix4 _to_2d_mat[6];
167 static void init_type() {
168 CollisionSolid::init_type();
170 CollisionSolid::get_class_type());
172 virtual TypeHandle get_type()
const {
173 return get_class_type();
175 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
178 static TypeHandle _type_handle;
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This functions similarly to a LightAttrib.
static void register_with_read_factory()
Factory method to generate a CollisionBox object.
PN_stdfloat dist_to_polygon(const LPoint2 &p, const Points &points) const
Returns the linear distance from the 2-d point to the nearest part of the polygon defined by the poin...
void setup_points(const LPoint3 *begin, const LPoint3 *end, int plane)
Computes the plane and 2d projection of points that make up this side.
static void flush_level()
Flushes the PStatCollectors used during traversal.
bool apply_clip_plane(Points &new_points, const ClipPlaneAttrib *cpa, const TransformState *net_transform, int plane_no) const
Clips the polygon by all of the clip planes named in the clip plane attribute and fills new_points up...
CollisionBox(const LPoint3 ¢er, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Create the Box by giving a Center and distances of each of the sides of box from the Center.
bool clip_polygon(Points &new_points, const Points &source_points, const LPlane &plane, int plane_no) const
Clips the source_points of the polygon by the indicated clipping plane, and modifies new_points to re...
Points get_plane_points(int n)
returns the points that form the nth plane
LPoint3 get_point_aabb(int n) const
Returns the nth vertex of the Axis Aligned Bounding Box.
virtual PointerTo< CollisionEntry > test_intersection(const CollisionEntry &entry) const
First Dispatch point for box as a FROM object.
void calc_to_3d_mat(LMatrix4 &to_3d_mat, int plane) const
Fills the indicated matrix with the appropriate rotation transform to move points from the 2-d plane ...
static void compute_vectors(Points &points)
Now that the _p members of the given points array have been computed, go back and compute all of the ...
void setup_box()
Compute parameters for each of the box's sides.
LPlane get_plane(int n) const
Returns the nth face of the rectangular solid.
bool point_is_inside(const LPoint2 &p, const Points &points) const
Returns true if the indicated point is within the polygon's 2-d space, false otherwise.
int get_num_points() const
Returns 8: the number of vertices of a rectangular solid.
LPoint2 to_2d(const LVecBase3 &point3d, int plane) const
Assuming the indicated point in 3-d space lies within the polygon's plane, returns the corresponding ...
LPoint3 get_point(int n) const
Returns the nth vertex of the OBB.
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
void rederive_to_3d_mat(LMatrix4 &to_3d_mat, int plane) const
Fills the indicated matrix with the appropriate rotation transform to move points from the 2-d plane ...
static LPoint3 to_3d(const LVecBase2 &point2d, const LMatrix4 &to_3d_mat)
Extrude the indicated point in the polygon's 2-d definition space back into 3-d coordinates.
int get_num_planes() const
Returns 6: the number of faces of a rectangular solid.
LPlane set_plane(int n) const
Creates the nth face of the rectangular solid.
Defines a single collision event.
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
virtual void xform(const LMatrix4 &mat)
Transforms the solid by the indicated matrix.
virtual PStatCollector & get_volume_pcollector()
Returns a PStatCollector that is used to count the number of bounding volume tests made against a sol...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
A node that holds Geom objects, renderable pieces of geometry.
A lightweight class that represents a single element that may be timed and/or counted via stats.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_right(const LVector2 &v1, const LVector2 &v2)
Returns true if the 2-d v1 is to the right of v2.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...