Docs update for trunk and branch.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1508 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
2489bda2e8
commit
e78db30247
@ -133,7 +133,7 @@ class line2d
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Check if the given point is a member of the line
|
//! Check if the given point is a member of the line
|
||||||
/** \return Returns true if point is between start and end, else false. */
|
/** \return True if point is between start and end, else false. */
|
||||||
bool isPointOnLine(const vector2d<T>& point) const
|
bool isPointOnLine(const vector2d<T>& point) const
|
||||||
{
|
{
|
||||||
T d = getPointOrientation(point);
|
T d = getPointOrientation(point);
|
||||||
|
@ -73,7 +73,7 @@ class line3d
|
|||||||
return end - start;
|
return end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns if the given point is between start and end of the line.
|
//! Check if the given point is between start and end of the line.
|
||||||
/** Assumes that the point is already somewhere on the line.
|
/** Assumes that the point is already somewhere on the line.
|
||||||
\param point The point to test.
|
\param point The point to test.
|
||||||
\return True if point is on the line between start and end, else false.
|
\return True if point is on the line between start and end, else false.
|
||||||
@ -83,7 +83,7 @@ class line3d
|
|||||||
return point.isBetweenPoints(start, end);
|
return point.isBetweenPoints(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the closest point on this line to a point
|
//! Get the closest point on this line to a point
|
||||||
/** \param point The point to compare to.
|
/** \param point The point to compare to.
|
||||||
\return The nearest point which is part of the line. */
|
\return The nearest point which is part of the line. */
|
||||||
vector3d<T> getClosestPoint(const vector3d<T>& point) const
|
vector3d<T> getClosestPoint(const vector3d<T>& point) const
|
||||||
@ -103,11 +103,11 @@ class line3d
|
|||||||
return start + v;
|
return start + v;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns if the line intersects with a shpere
|
//! Check if the line intersects with a shpere
|
||||||
/** \param sorigin: Origin of the shpere.
|
/** \param sorigin: Origin of the shpere.
|
||||||
\param sradius: Radius of the sphere.
|
\param sradius: Radius of the sphere.
|
||||||
\param outdistance: The distance to the first intersection point.
|
\param outdistance: The distance to the first intersection point.
|
||||||
\return Returns true if there is an intersection.
|
\return True if there is an intersection.
|
||||||
If there is one, the distance to the first intersection point
|
If there is one, the distance to the first intersection point
|
||||||
is stored in outdistance. */
|
is stored in outdistance. */
|
||||||
bool getIntersectionWithSphere(vector3d<T> sorigin, T sradius, f64& outdistance) const
|
bool getIntersectionWithSphere(vector3d<T> sorigin, T sradius, f64& outdistance) const
|
||||||
|
@ -66,7 +66,7 @@ class plane3d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns an intersection with a 3d line.
|
//! Get an intersection with a 3d line.
|
||||||
/** \param lineVect Vector of the line to intersect with.
|
/** \param lineVect Vector of the line to intersect with.
|
||||||
\param linePoint Point of the line to intersect with.
|
\param linePoint Point of the line to intersect with.
|
||||||
\param outIntersection Place to store the intersection point, if there is one.
|
\param outIntersection Place to store the intersection point, if there is one.
|
||||||
@ -86,7 +86,7 @@ class plane3d
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns where on a line between two points an intersection with this plane happened.
|
//! Get percentage of line between two points where an intersection with this plane happens.
|
||||||
/** Only useful if known that there is an intersection.
|
/** Only useful if known that there is an intersection.
|
||||||
\param linePoint1 Point1 of the line to intersect with.
|
\param linePoint1 Point1 of the line to intersect with.
|
||||||
\param linePoint2 Point2 of the line to intersect with.
|
\param linePoint2 Point2 of the line to intersect with.
|
||||||
@ -101,7 +101,7 @@ class plane3d
|
|||||||
return (f32)-((Normal.dotProduct(linePoint1) + D) / t2);
|
return (f32)-((Normal.dotProduct(linePoint1) + D) / t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns an intersection with a 3d line, limited between two 3d points.
|
//! Get an intersection with a 3d line, limited between two 3d points.
|
||||||
/** \param linePoint1 Point 1 of the line.
|
/** \param linePoint1 Point 1 of the line.
|
||||||
\param linePoint2 Point 2 of the line.
|
\param linePoint2 Point 2 of the line.
|
||||||
\param outIntersection Place to store the intersection point, if there is one.
|
\param outIntersection Place to store the intersection point, if there is one.
|
||||||
@ -180,7 +180,7 @@ class plane3d
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the intersection point with two other planes if there is one.
|
//! Get the intersection point with two other planes if there is one.
|
||||||
bool getIntersectionWithPlanes(const plane3d<T>& o1,
|
bool getIntersectionWithPlanes(const plane3d<T>& o1,
|
||||||
const plane3d<T>& o2, vector3d<T>& outPoint) const
|
const plane3d<T>& o2, vector3d<T>& outPoint) const
|
||||||
{
|
{
|
||||||
@ -198,7 +198,7 @@ class plane3d
|
|||||||
Note that this only works if the normal is Normalized.
|
Note that this only works if the normal is Normalized.
|
||||||
Do not use this method with points as it will give wrong results!
|
Do not use this method with points as it will give wrong results!
|
||||||
\param lookDirection: Look direction.
|
\param lookDirection: Look direction.
|
||||||
\return Returns true if the plane is front facing and
|
\return True if the plane is front facing and
|
||||||
false if it is backfacing. */
|
false if it is backfacing. */
|
||||||
bool isFrontFacing(const vector3d<T>& lookDirection) const
|
bool isFrontFacing(const vector3d<T>& lookDirection) const
|
||||||
{
|
{
|
||||||
@ -206,7 +206,7 @@ class plane3d
|
|||||||
return F32_LOWER_EQUAL_0 ( d );
|
return F32_LOWER_EQUAL_0 ( d );
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the distance to a point.
|
//! Get the distance to a point.
|
||||||
/** Note that this only works if the normal is normalized. */
|
/** Note that this only works if the normal is normalized. */
|
||||||
T getDistanceTo(const vector3d<T>& point) const
|
T getDistanceTo(const vector3d<T>& point) const
|
||||||
{
|
{
|
||||||
|
@ -39,9 +39,8 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Determines if the triangle is totally inside a bounding box.
|
//! Determines if the triangle is totally inside a bounding box.
|
||||||
//! \param box: Box to check.
|
/** \param box Box to check.
|
||||||
//! \return Returns true if the triangle is within the box,
|
\return True if triangle is within the box, otherwise false. */
|
||||||
//! and false otherwise.
|
|
||||||
bool isTotalInsideBox(const aabbox3d<T>& box) const
|
bool isTotalInsideBox(const aabbox3d<T>& box) const
|
||||||
{
|
{
|
||||||
return (box.isPointInside(pointA) &&
|
return (box.isPointInside(pointA) &&
|
||||||
@ -50,8 +49,8 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Get the closest point on a triangle to a point on the same plane.
|
//! Get the closest point on a triangle to a point on the same plane.
|
||||||
//! \param p: Point which must be on the same plane as the triangle.
|
/** \param p Point which must be on the same plane as the triangle.
|
||||||
//! \return The closest point of the triangle
|
\return The closest point of the triangle */
|
||||||
core::vector3d<T> closestPointOnTriangle(const core::vector3d<T>& p) const
|
core::vector3d<T> closestPointOnTriangle(const core::vector3d<T>& p) const
|
||||||
{
|
{
|
||||||
const core::vector3d<T> rab = line3d<T>(pointA, pointB).getClosestPoint(p);
|
const core::vector3d<T> rab = line3d<T>(pointA, pointB).getClosestPoint(p);
|
||||||
@ -69,9 +68,9 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Check if a point is inside the triangle
|
//! Check if a point is inside the triangle
|
||||||
//! \param p: Point to test. Assumes that this point is already on the plane
|
/** \param p Point to test. Assumes that this point is already
|
||||||
//! of the triangle.
|
on the plane of the triangle.
|
||||||
//! \return Returns true if the point is inside the triangle, otherwise false.
|
\return True if the point is inside the triangle, otherwise false. */
|
||||||
bool isPointInside(const vector3d<T>& p) const
|
bool isPointInside(const vector3d<T>& p) const
|
||||||
{
|
{
|
||||||
return (isOnSameSide(p, pointA, pointB, pointC) &&
|
return (isOnSameSide(p, pointA, pointB, pointC) &&
|
||||||
@ -79,13 +78,13 @@ namespace core
|
|||||||
isOnSameSide(p, pointC, pointA, pointB));
|
isOnSameSide(p, pointC, pointA, pointB));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Check if a point is inside the triangle. This method is an
|
//! Check if a point is inside the triangle.
|
||||||
//! implementation of the example used in a paper by Kasper
|
/** This method is an implementation of the example used in a
|
||||||
//! Fauerby original written by Keidy from Mr-Gamemaker.
|
paper by Kasper Fauerby original written by Keidy from
|
||||||
//! \param p: Point to test. Assumes that this point is already
|
Mr-Gamemaker.
|
||||||
//! on the plane of the triangle.
|
\param p Point to test. Assumes that this point is already
|
||||||
//! \return Returns true if the point is inside the triangle,
|
on the plane of the triangle.
|
||||||
//! otherwise false.
|
\return True if point is inside the triangle, otherwise false. */
|
||||||
bool isPointInsideFast(const vector3d<T>& p) const
|
bool isPointInsideFast(const vector3d<T>& p) const
|
||||||
{
|
{
|
||||||
const vector3d<T> f = pointB - pointA;
|
const vector3d<T> f = pointB - pointA;
|
||||||
@ -110,9 +109,9 @@ namespace core
|
|||||||
|
|
||||||
|
|
||||||
//! Get an intersection with a 3d line.
|
//! Get an intersection with a 3d line.
|
||||||
//! \param line: Line to intersect with.
|
/** \param line Line to intersect with.
|
||||||
//! \param outIntersection: Place to store the intersection point, if there is one.
|
\param outIntersection Place to store the intersection point, if there is one.
|
||||||
//! \return Returns true if there was an intersection, false if not.
|
\return True if there was an intersection, false if not. */
|
||||||
bool getIntersectionWithLimitedLine(const line3d<T>& line,
|
bool getIntersectionWithLimitedLine(const line3d<T>& line,
|
||||||
vector3d<T>& outIntersection) const
|
vector3d<T>& outIntersection) const
|
||||||
{
|
{
|
||||||
@ -122,15 +121,15 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns an intersection with a 3d line.
|
//! Get an intersection with a 3d line.
|
||||||
//! Please note that also points are returned as intersection which
|
/** Please note that also points are returned as intersection which
|
||||||
//! are on the line, but not between the start and end point of the line.
|
are on the line, but not between the start and end point of the line.
|
||||||
//! If you want the returned point be between start and end
|
If you want the returned point be between start and end
|
||||||
//! use getIntersectionWithLimitedLine().
|
use getIntersectionWithLimitedLine().
|
||||||
//! \param linePoint: Point of the line to intersect with.
|
\param linePoint Point of the line to intersect with.
|
||||||
//! \param lineVect: Vector of the line to intersect with.
|
\param lineVect Vector of the line to intersect with.
|
||||||
//! \param outIntersection: Place to store the intersection point, if there is one.
|
\param outIntersection Place to store the intersection point, if there is one.
|
||||||
//! \return Returns true if there was an intersection, false if there was not.
|
\return True if there was an intersection, false if there was not. */
|
||||||
bool getIntersectionWithLine(const vector3d<T>& linePoint,
|
bool getIntersectionWithLine(const vector3d<T>& linePoint,
|
||||||
const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
|
const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
|
||||||
{
|
{
|
||||||
@ -141,12 +140,11 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Calculates the intersection between a 3d line and
|
//! Calculates the intersection between a 3d line and the plane the triangle is on.
|
||||||
//! the plane the triangle is on.
|
/** \param lineVect Vector of the line to intersect with.
|
||||||
//! \param lineVect: Vector of the line to intersect with.
|
\param linePoint Point of the line to intersect with.
|
||||||
//! \param linePoint: Point of the line to intersect with.
|
\param outIntersection Place to store the intersection point, if there is one.
|
||||||
//! \param outIntersection: Place to store the intersection point, if there is one.
|
\return True if there was an intersection, else false. */
|
||||||
//! \return Returns true if there was an intersection, false if there was not.
|
|
||||||
bool getIntersectionOfPlaneWithLine(const vector3d<T>& linePoint,
|
bool getIntersectionOfPlaneWithLine(const vector3d<T>& linePoint,
|
||||||
const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
|
const vector3d<T>& lineVect, vector3d<T>& outIntersection) const
|
||||||
{
|
{
|
||||||
@ -163,21 +161,19 @@ namespace core
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Returns the normal of the triangle.
|
//! Get the normal of the triangle.
|
||||||
//! Please note: The normal is not normalized.
|
/** Please note: The normal is not always normalized. */
|
||||||
vector3d<T> getNormal() const
|
vector3d<T> getNormal() const
|
||||||
{
|
{
|
||||||
return (pointB - pointA).crossProduct(pointC - pointA);
|
return (pointB - pointA).crossProduct(pointC - pointA);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Test if the triangle would be front or backfacing from any
|
//! Test if the triangle would be front or backfacing from any point.
|
||||||
//! point. Thus, this method assumes a camera position from
|
/** Thus, this method assumes a camera position from which the
|
||||||
//! which the triangle is definitely visible when looking into
|
triangle is definitely visible when looking at the given direction.
|
||||||
//! the given direction.
|
Do not use this method with points as it will give wrong results!
|
||||||
//! Do not use this method with points as it will give wrong results!
|
\param lookDirection Look direction.
|
||||||
//! \param lookDirection: Look direction.
|
\return True if the plane is front facing and false if it is backfacing. */
|
||||||
//! \return Returns true if the plane is front facing and
|
|
||||||
//! false if it is backfacing.
|
|
||||||
bool isFrontFacing(const vector3d<T>& lookDirection) const
|
bool isFrontFacing(const vector3d<T>& lookDirection) const
|
||||||
{
|
{
|
||||||
const vector3d<T> n = getNormal().normalize();
|
const vector3d<T> n = getNormal().normalize();
|
||||||
@ -185,13 +181,13 @@ namespace core
|
|||||||
return F32_LOWER_EQUAL_0(d);
|
return F32_LOWER_EQUAL_0(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the plane of this triangle.
|
//! Get the plane of this triangle.
|
||||||
plane3d<T> getPlane() const
|
plane3d<T> getPlane() const
|
||||||
{
|
{
|
||||||
return plane3d<T>(pointA, pointB, pointC);
|
return plane3d<T>(pointA, pointB, pointC);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the area of the triangle
|
//! Get the area of the triangle
|
||||||
T getArea() const
|
T getArea() const
|
||||||
{
|
{
|
||||||
return (pointB - pointA).crossProduct(pointC - pointA).getLength() * 0.5;
|
return (pointB - pointA).crossProduct(pointC - pointA).getLength() * 0.5;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user