14 #ifndef COLLISIONPOLYGON_H 15 #define COLLISIONPOLYGON_H 34 const LVecBase3 &c,
const LVecBase3 &d);
48 INLINE
size_t get_num_points()
const;
49 INLINE LPoint3 get_point(
size_t n)
const;
50 MAKE_SEQ(get_points, get_num_points, get_point);
53 INLINE
static bool verify_points(
const LPoint3 &a,
const LPoint3 &b,
55 INLINE
static bool verify_points(
const LPoint3 &a,
const LPoint3 &b,
56 const LPoint3 &c,
const LPoint3 &d);
57 static bool verify_points(
const LPoint3 *begin,
const LPoint3 *end);
59 bool is_valid()
const;
60 bool is_concave()
const;
63 MAKE_SEQ_PROPERTY(points, get_num_points, get_point);
64 MAKE_PROPERTY(valid, is_valid);
65 MAKE_PROPERTY(concave, is_concave);
68 virtual void xform(
const LMatrix4 &mat);
72 bool bounds_only)
const;
77 virtual void output(std::ostream &out)
const;
78 virtual void write(std::ostream &out,
int indent_level = 0)
const;
94 test_intersection_from_parabola(
const CollisionEntry &entry)
const;
98 virtual void fill_viz_geom();
101 INLINE
static bool is_right(
const LVector2 &v1,
const LVector2 &v2);
102 INLINE
static PN_stdfloat dist_to_line(
const LPoint2 &p,
103 const LPoint2 &f,
const LVector2 &v);
104 static PN_stdfloat dist_to_line_segment(
const LPoint2 &p,
105 const LPoint2 &f,
const LPoint2 &t,
111 INLINE PointDef(
const LPoint2 &p,
const LVector2 &v);
112 INLINE PointDef(PN_stdfloat x, PN_stdfloat y);
113 INLINE PointDef(
const PointDef ©);
114 INLINE
void operator = (
const PointDef ©);
121 static void compute_vectors(Points &points);
123 const Points &points)
const;
125 bool point_is_inside(
const LPoint2 &p,
const Points &points)
const;
126 PN_stdfloat dist_to_polygon(
const LPoint2 &p,
const Points &points)
const;
127 void project(
const LVector3 &axis, PN_stdfloat ¢er, PN_stdfloat &extent)
const;
129 void setup_points(
const LPoint3 *begin,
const LPoint3 *end);
130 INLINE LPoint2 to_2d(
const LVecBase3 &point3d)
const;
131 INLINE
void calc_to_3d_mat(LMatrix4 &to_3d_mat)
const;
132 INLINE
void rederive_to_3d_mat(LMatrix4 &to_3d_mat)
const;
133 INLINE
static LPoint3 to_3d(
const LVecBase2 &point2d,
const LMatrix4 &to_3d_mat);
134 LPoint3 legacy_to_3d(
const LVecBase2 &point2d,
int axis)
const;
136 bool clip_polygon(Points &new_points,
const Points &source_points,
137 const LPlane &plane)
const;
161 static void init_type() {
162 CollisionPlane::init_type();
164 CollisionPlane::get_class_type());
167 return get_class_type();
169 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
Base class for objects that can be written to and read from Bam files.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
bool is_right(const LVector2 &v1, const LVector2 &v2)
Returns true if the 2-d v1 is to the right of v2.
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.
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a single collision event.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual PStatCollector & get_test_pcollector()
Returns a PStatCollector that is used to count the number of intersection tests made against a solid ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PStatCollector & get_volume_pcollector()
Returns a PStatCollector that is used to count the number of bounding volume tests made against a sol...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.