Go to the documentation of this file.
50 return entry.
get_into()->test_intersection_from_segment(entry);
56 void CollisionSegment::
57 xform(
const LMatrix4 &mat) {
61 CollisionSolid::xform(mat);
77 void CollisionSegment::
78 output(std::ostream &out)
const {
79 out <<
"segment, a (" << _a <<
"), b (" << _b <<
")";
95 if (!proj->
extrude(point, _a, _b)) {
96 _a = LPoint3::origin();
97 _b = _a + LVector3::forward();
101 mark_internal_bounds_stale();
111 compute_internal_bounds()
const {
113 LVector3 pdelta = _b - _a;
116 PN_stdfloat d2 = pdelta.length_squared();
117 if (d2 < collision_parabola_bounds_threshold * collision_parabola_bounds_threshold) {
118 LPoint3 pmid = (_a + _b) * 0.5f;
122 LMatrix4 from_segment;
123 look_at(from_segment, pdelta, LPoint3(0,0,1), CS_zup_right);
124 from_segment.set_row(3, _a);
126 PN_stdfloat max_y = sqrt(d2) + 0.01;
129 LPoint3(0.01, max_y, 0.01), LPoint3(-0.01, max_y, 0.01),
130 LPoint3(-0.01, -0.01, -0.01), LPoint3(0.01, 0.01, -0.01),
131 LPoint3(0.01, -0.01, 0.01), LPoint3(-0.01, -0.01, 0.01));
133 volume->xform(from_segment);
141 void CollisionSegment::
143 if (collide_cat.is_debug()) {
145 <<
"Recomputing viz for " << *
this <<
"\n";
153 vertex.add_data3(_a);
154 vertex.add_data3(_b);
157 line->add_next_vertices(2);
158 line->close_primitive();
161 geom->add_primitive(line);
163 _viz_geom->add_geom(geom, get_other_viz_state());
164 _bounds_viz_geom->add_geom(geom, get_other_bounds_viz_state());
182 _a.write_datagram(dg);
183 _b.write_datagram(dg);
198 node->fillin(scan, manager);
207 void CollisionSegment::
209 CollisionSolid::fillin(scan, manager);
210 _a.read_datagram(scan);
211 _b.read_datagram(scan);
A container for geometry primitives.
A finite line segment, with two specific endpoints but no thickness.
bool set_from_lens(LensNode *camera, const LPoint2 &point)
Accepts a LensNode and a 2-d point in the range [-1,1].
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CollisionSegment()
Creates an invalid segment.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This defines a bounding sphere, consisting of a center and a radius.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
Defines a single collision event.
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 object provides a high-level interface for quickly writing a sequence of numeric values from a v...
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
TypeHandle is the identifier used to differentiate C++ class types.
PT(CollisionEntry) CollisionSegment
Transforms the solid by the indicated matrix.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionSegment.
A base class for any number of different kinds of lenses, linear and otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual LPoint3 get_collision_origin() const
Returns the point in space deemed to be the "origin" of the solid for collision purposes.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
The abstract base class for all things that can collide with other things in the world,...
Lens * get_lens(int index=0) const
Returns a pointer to the particular Lens associated with this LensNode, or NULL if there is not yet a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that contains a Lens.
Defines a series of disconnected line segments.
get_into
Returns the CollisionSolid pointer for the particular solid was collided into.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines a bounding convex hexahedron.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
bool extrude(const LPoint2 &point2d, LPoint3 &near_point, LPoint3 &far_point) const
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.