15 #ifndef COLLISIONPOLYGON_H
16 #define COLLISIONPOLYGON_H
18 #include "pandabase.h"
20 #include "collisionPlane.h"
21 #include "clipPlaneAttrib.h"
40 INLINE CollisionPolygon();
43 CollisionPolygon(
const CollisionPolygon ©);
50 INLINE
int get_num_points()
const;
51 INLINE
LPoint3 get_point(
int n)
const;
52 MAKE_SEQ(get_points, get_num_points, get_point);
55 INLINE
static bool verify_points(
const LPoint3 &a,
const LPoint3 &b,
57 INLINE
static bool verify_points(
const LPoint3 &a,
const LPoint3 &b,
59 static bool verify_points(
const LPoint3 *begin,
const LPoint3 *end);
61 bool is_valid()
const;
62 bool is_concave()
const;
69 bool bounds_only)
const;
74 virtual void output(ostream &out)
const;
75 virtual void write(ostream &out,
int indent_level = 0)
const;
91 test_intersection_from_parabola(
const CollisionEntry &entry)
const;
93 virtual void fill_viz_geom();
97 INLINE
static PN_stdfloat dist_to_line(
const LPoint2 &p,
99 static PN_stdfloat dist_to_line_segment(
const LPoint2 &p,
107 INLINE PointDef(PN_stdfloat x, PN_stdfloat y);
108 INLINE PointDef(
const PointDef ©);
109 INLINE
void operator = (
const PointDef ©);
116 static void compute_vectors(
Points &points);
118 const Points &points)
const;
120 bool point_is_inside(
const LPoint2 &p,
const Points &points)
const;
121 PN_stdfloat dist_to_polygon(
const LPoint2 &p,
const Points &points)
const;
125 INLINE
void calc_to_3d_mat(
LMatrix4 &to_3d_mat)
const;
126 INLINE
void rederive_to_3d_mat(
LMatrix4 &to_3d_mat)
const;
130 bool clip_polygon(
Points &new_points,
const Points &source_points,
131 const LPlane &plane)
const;
133 const TransformState *net_transform)
const;
155 static void init_type() {
156 CollisionPlane::init_type();
157 register_type(_type_handle,
"CollisionPolygon",
158 CollisionPlane::get_class_type());
161 return get_class_type();
163 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
169 #include "collisionPolygon.I"
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
A basic node of the scene graph or data graph.
This is the base class for all three-component vectors and points.
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
The abstract base class for all things that can collide with other things in the world, and all the things they can collide with (except geometry).
Base class for objects that can be written to and read from Bam files.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This functions similarly to a LightAttrib.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
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...
A lightweight class that represents a single element that may be timed and/or counted via stats...
virtual void xform(const LMatrix4 &mat)
Transforms the solid by the indicated matrix.
This is a 4-by-4 transform matrix.
Defines a single collision event.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is the base class for all two-component vectors and points.
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
virtual PStatCollector & get_volume_pcollector()
Returns a PStatCollector that is used to count the number of bounding volume tests made against a sol...
This is a two-component vector offset.
static void register_with_read_factory()
Factory method to generate a CollisionPlane object.
static void flush_level()
Flushes the PStatCollectors used during traversal.
A class to retrieve the individual data elements previously stored in a Datagram. ...
This is a two-component point in space.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
A node that holds Geom objects, renderable pieces of geometry.