14#ifndef COLLISIONPOLYGON_H
15#define COLLISIONPOLYGON_H
34 const LVecBase3 &c,
const LVecBase3 &d);
45 static bool verify_points(
const LPoint3 *begin,
const LPoint3 *end);
50 INLINE
size_t get_num_points()
const;
51 INLINE LPoint3 get_point(
size_t 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,
58 const LPoint3 &c,
const LPoint3 &d);
60 bool is_valid()
const;
61 bool is_concave()
const;
64 MAKE_SEQ_PROPERTY(points, get_num_points, get_point);
65 MAKE_PROPERTY(valid, is_valid);
66 MAKE_PROPERTY(concave, is_concave);
69 virtual void xform(
const LMatrix4 &mat);
73 bool bounds_only)
const;
78 virtual void output(std::ostream &out)
const;
79 virtual void write(std::ostream &out,
int indent_level = 0)
const;
97 test_intersection_from_parabola(
const CollisionEntry &entry)
const;
101 virtual void fill_viz_geom();
104 INLINE
static bool is_right(
const LVector2 &v1,
const LVector2 &v2);
105 INLINE
static PN_stdfloat dist_to_line(
const LPoint2 &p,
106 const LPoint2 &f,
const LVector2 &v);
107 static PN_stdfloat dist_to_line_segment(
const LPoint2 &p,
108 const LPoint2 &f,
const LPoint2 &t,
114 INLINE PointDef(
const LPoint2 &p,
const LVector2 &v);
115 INLINE PointDef(PN_stdfloat x, PN_stdfloat y);
116 INLINE PointDef(
const PointDef ©);
117 INLINE
void operator = (
const PointDef ©);
124 static void compute_vectors(Points &points);
126 const Points &points)
const;
128 bool point_is_inside(
const LPoint2 &p,
const Points &points)
const;
129 PN_stdfloat dist_to_polygon(
const LPoint2 &p,
const Points &points)
const;
130 void project(
const LVector3 &axis, PN_stdfloat ¢er, PN_stdfloat &extent)
const;
132 void setup_points(
const LPoint3 *begin,
const LPoint3 *end);
133 INLINE LPoint2 to_2d(
const LVecBase3 &point3d)
const;
134 INLINE
void calc_to_3d_mat(LMatrix4 &to_3d_mat)
const;
135 INLINE
void rederive_to_3d_mat(LMatrix4 &to_3d_mat)
const;
136 INLINE
static LPoint3 to_3d(
const LVecBase2 &point2d,
const LMatrix4 &to_3d_mat);
137 LPoint3 legacy_to_3d(
const LVecBase2 &point2d,
int axis)
const;
139 bool clip_polygon(Points &new_points,
const Points &source_points,
140 const LPlane &plane)
const;
164 static void init_type() {
165 CollisionPlane::init_type();
167 CollisionPlane::get_class_type());
170 return get_class_type();
172 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
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.
Defines a single collision event.
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
static void register_with_read_factory()
Factory method to generate a CollisionPlane object.
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.
static void flush_level()
Flushes the PStatCollectors used during traversal.
virtual PStatCollector & get_volume_pcollector()
Returns a PStatCollector that is used to count the number of bounding volume tests made against a sol...
The abstract base class for all things that can collide with other things in the world,...
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
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.
A basic node of the scene graph or data graph.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
This is our own Panda specialization on the default STL vector.
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(),...