#include <Cylinder.h>
G3D::Cylinder::Cylinder |
( |
| ) |
|
void deserialize(class BinaryInput &b)
Definition: Cylinder.cpp:45
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
Vector3 p2
Definition: Cylinder.h:30
float G3D::Cylinder::area |
( |
| ) |
const |
float mRadius
Definition: Cylinder.h:32
double square(double fValue)
Definition: g3dmath.h:698
float height() const
Definition: Cylinder.h:74
double twoPi()
Definition: g3dmath.h:159
Line G3D::Cylinder::axis |
( |
| ) |
const |
The line down the center of the Cylinder
Vector3 p1
Definition: Cylinder.h:29
Vector3 p2
Definition: Cylinder.h:30
static Line fromTwoPoints(const Vector3 &point1, const Vector3 &point2)
Definition: Line.h:52
Vector3 G3D::Cylinder::center |
( |
| ) |
const |
|
inline |
Center of mass
71 return (
p1 +
p2) / 2.0f;
Vector3 p1
Definition: Cylinder.h:29
Vector3 p2
Definition: Cylinder.h:30
Returns true if the point is inside the Cylinder or on its surface.
static LineSegment fromTwoPoints(const Point3 &point1, const Point3 &point2)
Definition: LineSegment.h:47
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
double distanceSquared(const Point3 &p) const
Definition: LineSegment.h:74
double square(double fValue)
Definition: g3dmath.h:698
Vector3 p2
Definition: Cylinder.h:30
void G3D::Cylinder::deserialize |
( |
class BinaryInput & |
b | ) |
|
48 mRadius = (float)b.readFloat64();
Vector3 p1
Definition: Cylinder.h:29
void deserialize(class BinaryInput &b)
Definition: Vector3.cpp:190
float mRadius
Definition: Cylinder.h:32
Vector3 p2
Definition: Cylinder.h:30
void G3D::Cylinder::getBounds |
( |
AABox & |
out | ) |
const |
Get close axis aligned bounding box. With vertical world orientation, the top and bottom might not be very tight.
81 out = AABox(min, max);
Vector3 __fastcall max(const Vector3 &v) const
Definition: Vector3.h:794
Vector3 __fastcall min(const Vector3 &v) const
Definition: Vector3.h:789
T max(const T &x, const T &y)
Definition: g3dmath.h:320
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
Vector3 p2
Definition: Cylinder.h:30
void G3D::Cylinder::getRandomSurfacePoint |
( |
Vector3 & |
P, |
|
|
Vector3 & |
N |
|
) |
| const |
Random world space point with outward facing normal.
109 float capRelArea =
square(r) / 2.0f;
110 float sideRelArea = r * h;
114 if (r1 < capRelArea * 2) {
125 if (r1 < capRelArea) {
146 CoordinateFrame cframe;
149 p = cframe.pointToWorldSpace(p);
150 N = cframe.normalToWorldSpace(N);
void getReferenceFrame(class CoordinateFrame &cframe) const
Definition: Cylinder.cpp:89
float uniformRandom(float low=0.0f, float hi=1.0f)
Definition: g3dmath.h:694
double square(double fValue)
Definition: g3dmath.h:698
float height() const
Definition: Cylinder.h:74
double twoPi()
Definition: g3dmath.h:159
float radius() const
Definition: Cylinder.cpp:58
void G3D::Cylinder::getReferenceFrame |
( |
class CoordinateFrame & |
cframe | ) |
const |
A reference frame in which the center of mass is at the origin and the Y-axis is the cylinder's axis. If the cylinder is transformed, this reference frame may freely rotate around its axis.
90 cframe.translation =
center();
92 Vector3
Y = (
p1 -
p2).direction();
94 Vector3
Z = X.cross(Y).direction();
96 cframe.rotation.setColumn(0, X);
97 cframe.rotation.setColumn(1, Y);
98 cframe.rotation.setColumn(2, Z);
#define Z
Definition: CollisionDetection.cpp:2283
#define X
Definition: CollisionDetection.cpp:2281
double abs(double fValue)
Definition: g3dmath.h:617
Vector3 center() const
Definition: Cylinder.h:70
static const Vector3 & unitX()
Definition: Vector3.cpp:121
static const Vector3 & unitY()
Definition: Vector3.cpp:122
Vector3 p1
Definition: Cylinder.h:29
Vector3 p2
Definition: Cylinder.h:30
#define Y
Definition: CollisionDetection.cpp:2282
float G3D::Cylinder::height |
( |
| ) |
const |
|
inline |
75 return (
p1 -
p2).magnitude();
Vector3 p1
Definition: Cylinder.h:29
Vector3 p2
Definition: Cylinder.h:30
Returns point 0 or 1
55 return (i == 0) ?
p1 :
p2;
#define debugAssert(exp)
Definition: debugAssert.h:160
Vector3 p1
Definition: Cylinder.h:29
Vector3 p2
Definition: Cylinder.h:30
float G3D::Cylinder::radius |
( |
| ) |
const |
float mRadius
Definition: Cylinder.h:32
Vector3 G3D::Cylinder::randomInteriorPoint |
( |
| ) |
const |
Point selected uniformly at random over the volume.
165 Vector3 p( cos(a) * r2,
170 CoordinateFrame cframe;
173 return cframe.pointToWorldSpace(p);
void getReferenceFrame(class CoordinateFrame &cframe) const
Definition: Cylinder.cpp:89
float uniformRandom(float low=0.0f, float hi=1.0f)
Definition: g3dmath.h:694
float height() const
Definition: Cylinder.h:74
double twoPi()
Definition: g3dmath.h:159
float radius() const
Definition: Cylinder.cpp:58
void G3D::Cylinder::serialize |
( |
class BinaryOutput & |
b | ) |
const |
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
void serialize(class BinaryOutput &b) const
Definition: Vector3.cpp:219
Vector3 p2
Definition: Cylinder.h:30
float G3D::Cylinder::volume |
( |
| ) |
const |
double pi()
Definition: g3dmath.h:147
Vector3 p1
Definition: Cylinder.h:29
float mRadius
Definition: Cylinder.h:32
double square(double fValue)
Definition: g3dmath.h:698
Vector3 p2
Definition: Cylinder.h:30
float G3D::Cylinder::mRadius |
|
private |
The documentation for this class was generated from the following files: