14 #ifndef COLLISIONBOX_H
15 #define COLLISIONBOX_H
30 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
31 INLINE
explicit CollisionBox(
const LPoint3 &min,
const LPoint3 &max);
33 virtual LPoint3 get_collision_origin()
const;
44 virtual void xform(
const LMatrix4 &mat);
49 virtual void output(std::ostream &out)
const;
51 INLINE
static void flush_level();
55 INLINE
int get_num_points()
const;
56 INLINE LPoint3 get_point_aabb(
int n)
const;
57 INLINE LPoint3 get_point(
int n)
const;
58 INLINE
int get_num_planes()
const;
59 INLINE LPlane set_plane(
int n)
const;
60 INLINE LPlane get_plane(
int n)
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);
123 INLINE
void operator = (
const PointDef ©);
130 static void compute_vectors(
Points &points);
132 const Points &points)
const;
134 bool point_is_inside(
const LPoint2 &p,
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;
139 INLINE
void calc_to_3d_mat(LMatrix4 &to_3d_mat,
int plane)
const;
140 INLINE
void rederive_to_3d_mat(LMatrix4 &to_3d_mat,
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];
153 INLINE
Points get_plane_points(
int n );
156 static void register_with_read_factory();
167 static void init_type() {
168 CollisionSolid::init_type();
170 CollisionSolid::get_class_type());
173 return get_class_type();
175 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}