51 #include "stringtool.h"
52 #include "MathTools/mathtools.h"
72 Distance(Other.Distance)
81 { this->
Define(Norm,Point); }
84 { this->
Define(First,Second,Third); }
109 Vector3 Edge1 = Second - First;
120 return Plane::S_Negative;
121 }
else if( Dist > 0.0 ) {
122 return Plane::S_Positive;
124 return Plane::S_None;
132 if( CenterDist < -MaxDist ) {
133 return Plane::S_Negative;
134 }
else if( CenterDist > +MaxDist ) {
135 return Plane::S_Positive;
137 return Plane::S_Both;
154 Real denom = 1.0 / cp;
160 Real denom = 1.0 / cp;
166 Real denom = 1.0 / cp;
172 return Ray(point1,direction);
176 {
return MathTools::Overlap(*
this,ToCheck); }
179 {
return MathTools::Overlap(ToCheck,*
this); }
182 {
return MathTools::Overlap(*
this,ToCheck); }
185 {
return MathTools::Intersects(*
this,ToCheck); }
200 this->
Normal = InternalPlane.normal;
230 if( !CurrAttrib.
Empty() )
235 if( !NormalNode.
Empty() )
268 stream <<
"<Plane Version=\"1\" Distance=\"" << x.
Distance <<
"\" >" << x.
Normal <<
"</Plane>";
278 Doc->GetFirstChild() >> x;
This is a generic sphere class used for spacial queries.
String GetOneTag(std::istream &stream)
Gets the first tag out of the Stream and returns it as a String.
std::ostream & operator<<(std::ostream &stream, const Mezzanine::LinearInterpolator< T > &Lint)
Used to Serialize an Mezzanine::LinearInterpolator to a human readable stream.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
Side GetSide(const Vector3 &Point) const
Gets which side of the plane a point in 3D space is.
Vector3 CrossProduct(const Vector3 &Vec) const
This is used to calculate the crossproduct of this and another vector.
bool Boole
Generally acts a single bit, true or false.
Real X
Coordinate on the X vector.
Real Z
Coordinate on the Z vector.
Real GetDistance(const Vector3 &Point) const
Gets the distance from the plane to a point in 3D space.
Document * PreParseClassFromSingleTag(const String &NameSpace, const String &ClassName, const String &OneTag)
Perform a basic series of checks for extracting meaning from a single xml tag.
Thrown when the requested identity could not be found.
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
static String GetSerializableName()
Get the name of the the XML tag this class will leave behind as its instances are serialized...
A simple reference counting pointer.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Ogre::Plane GetOgrePlane() const
Gets an Ogre::Plane that contains this Planes information.
Ray GetOverlap(const Plane &Other) const
Gets the overlap of two Planes expressed as a Ray.
bool Empty() const
Is this storing anything at all?
This is used to represent a flat infinite slice of the game world.
This implements the exception hiearchy for Mezzanine.
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
Real Distance
How from from the origin the plane is.
Real Distance(const Vector3 &OtherVec) const
Gets the distance between this and another vector.
This file contains the AxisAlignedBox class for representing AABB's of objects in the world...
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
float Real
A Datatype used to represent a real floating point number.
The interface for serialization.
void Define(const Vector3 &Norm, const Real Constant)
Defines the dimensions of this plane explicitly.
bool SetValue(const Char8 *rhs)
Set the value of this.
This file contains a generic Sphere class for math and spacial query.
void operator=(const Plane &Other)
Assignment operator.
A light-weight handle for manipulating nodes in DOM tree.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
bool Empty() const
Is this storing anything at all?
Vector3 & Normalize()
This will change this point into it's own normal relative to the origin.
Ogre::Vector3 GetOgreVector3() const
Gets a Ogre vector3.
~Plane()
Class destructor.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
Boole operator==(const Plane &Other) const
Equality operator.
Real Y
Coordinate on the Y vector.
Vector3 Normal
The rotation of the plane.
Plane()
Default constructor.
Real DotProduct(const Vector3 &Vec) const
This is used to calculate the dotproduct of this and another vector.
void ProtoDeSerialize(const XML::Node &OneNode)
Take the data stored in an XML and overwrite this instance of this object with it.
Boole operator!=(const Plane &Other) const
Inequality operator.
Real SquaredLength() const
Gets the length of this vector squared.
This is used to represent a point in space, or a vector through space.
Boole IsOverlapping(const Sphere &ToCheck) const
Checks to see if a sphere overlaps with this Plane.
RayTestResult Intersects(const Ray &ToCheck) const
Checks to see if a ray intersects this Plane.
void ExtractOgrePlane(const Ogre::Plane &InternalPlane)
Changes this Plane to match the Ogre Plane.
The bulk of the engine components go in this namspace.
std::istream & operator>>(std::istream &stream, Mezzanine::LinearInterpolator< T > &Lint)
Used to de-serialize an Mezzanine::LinearInterpolator from a stream.
std::pair< Boole, Vector3 > RayTestResult
This is a type used for the return of a ray intersection test.
const Char8 * Name() const
ptrdiff_tGet the name of this Node.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
Side
An enum used to describe which side of the plane the result of a query is on.
std::string String
A datatype used to a series of characters.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
This represents a line placed in 3D space and is used with spacial queries.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
This is a utility class used to represent the Axis-Aligned Bounding Boxes of objects in various subsy...