18 TypeHandle FltTransformRotateAboutEdge::_type_handle;
23 FltTransformRotateAboutEdge::
25 _point_a.set(0.0, 0.0, 0.0);
26 _point_b.set(1.0, 0.0, 0.0);
35 set(
const LPoint3d &point_a,
const LPoint3d &point_b, PN_stdfloat angle) {
46 const LPoint3d &FltTransformRotateAboutEdge::
54 const LPoint3d &FltTransformRotateAboutEdge::
71 void FltTransformRotateAboutEdge::
73 if (_point_a == _point_b) {
75 _matrix = LMatrix4d::ident_mat();
77 LVector3d axis = _point_b - _point_a;
79 LMatrix4d::translate_mat(-_point_a) *
80 LMatrix4d::rotate_mat(_angle, normalize(axis), CS_zup_right) *
81 LMatrix4d::translate_mat(_point_a);
90 bool FltTransformRotateAboutEdge::
92 if (!FltTransformRecord::extract_record(reader)) {
96 nassertr(reader.
get_opcode() == FO_rotate_about_edge,
false);
101 _point_a[0] = iterator.get_be_float64();
102 _point_a[1] = iterator.get_be_float64();
103 _point_a[2] = iterator.get_be_float64();
104 _point_b[0] = iterator.get_be_float64();
105 _point_b[1] = iterator.get_be_float64();
106 _point_b[2] = iterator.get_be_float64();
107 _angle = iterator.get_be_float32();
109 iterator.skip_bytes(4);
122 bool FltTransformRotateAboutEdge::
124 if (!FltTransformRecord::build_record(writer)) {
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void check_remaining_size(const DatagramIterator &di, const std::string &name=std::string()) const
Checks that the iterator has no bytes left, as it should at the end of a successfully read record.
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
void pad_bytes(size_t size)
Adds the indicated number of zero bytes to the datagram.
void add_be_float64(PN_float64 value)
Adds a 64-bit big-endian floating-point number to the datagram.
void add_be_float32(PN_float32 value)
Adds a 32-bit single-precision big-endian floating-point number to the datagram.
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
void set_opcode(FltOpcode opcode)
Sets the opcode associated with the current record.
Datagram & update_datagram()
Returns a modifiable reference to the datagram associated with the current record.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...