Colobot
Namespaces | Functions
geometry.h File Reference

Math functions related to 3D geometry calculations, transformations, etc. More...

#include "math/const.h"
#include "math/func.h"
#include "math/matrix.h"
#include "math/point.h"
#include "math/vector.h"
#include <cmath>
#include <cstdlib>
Include dependency graph for geometry.h:

Go to the source code of this file.

Namespaces

 Math
 Namespace for (new) math code.
 

Functions

float Math::MidPoint (const Math::Point &a, const Math::Point &b, float px)
 Returns py up on the line a - b. More...
 
bool Math::IsInsideTriangle (Math::Point a, Math::Point b, Math::Point c, Math::Point p)
 Tests whether the point p is inside the triangle (a,b,c) More...
 
Math::Point Math::RotatePoint (const Math::Point &center, float angle, const Math::Point &p)
 Rotates a point around a center. More...
 
Math::Point Math::RotatePoint (float angle, const Math::Point &p)
 Rotates a point around the origin (0,0) More...
 
Math::Point Math::RotatePoint (float angle, float dist)
 Rotates a vector (dist, 0) More...
 
void Math::RotatePoint (float cx, float cy, float angle, float &px, float &py)
 Rotates a point around a center on 2D plane. More...
 
void Math::RotatePoint (const Math::Vector &center, float angleH, float angleV, Math::Vector &p)
 Rotates a point around a center in space. More...
 
void Math::RotatePoint2 (const Math::Vector center, float angleH, float angleV, Math::Vector &p)
 Rotates a point around a center in space. More...
 
float Math::RotateAngle (float x, float y)
 Returns the angle between point (x,y) and (0,0) More...
 
float Math::RotateAngle (const Math::Point &center, const Math::Point &p1, const Math::Point &p2)
 Calculates the angle between two points and a center. More...
 
void Math::LoadViewMatrix (Math::Matrix &mat, const Math::Vector &from, const Math::Vector &at, const Math::Vector &worldUp)
 Loads view matrix from the given vectors. More...
 
void Math::LoadProjectionMatrix (Math::Matrix &mat, float fov=Math::PI/2.0f, float aspect=1.0f, float nearPlane=1.0f, float farPlane=1000.0f)
 Loads a perspective projection matrix. More...
 
void Math::LoadOrthoProjectionMatrix (Math::Matrix &mat, float left, float right, float bottom, float top, float zNear=-1.0f, float zFar=1.0f)
 Loads an othogonal projection matrix. More...
 
void Math::LoadTranslationMatrix (Math::Matrix &mat, const Math::Vector &trans)
 Loads a translation matrix from given vector. More...
 
void Math::LoadScaleMatrix (Math::Matrix &mat, const Math::Vector &scale)
 Loads a scaling matrix fom given vector. More...
 
void Math::LoadRotationXMatrix (Math::Matrix &mat, float angle)
 Loads a rotation matrix along the X axis. More...
 
void Math::LoadRotationYMatrix (Math::Matrix &mat, float angle)
 Loads a rotation matrix along the Y axis. More...
 
void Math::LoadRotationZMatrix (Math::Matrix &mat, float angle)
 Loads a rotation matrix along the Z axis. More...
 
void Math::LoadRotationMatrix (Math::Matrix &mat, const Math::Vector &dir, float angle)
 Loads a rotation matrix along the given axis. More...
 
void Math::LoadRotationXZYMatrix (Math::Matrix &mat, const Math::Vector &angles)
 Calculates the matrix to make three rotations in the order X, Z and Y. More...
 
void Math::LoadRotationZXYMatrix (Math::Matrix &mat, const Math::Vector &angles)
 Calculates the matrix to make three rotations in the order Z, X and Y. More...
 
float Math::DistanceProjected (const Math::Vector &a, const Math::Vector &b)
 Returns the distance between projections on XZ plane of two vectors. More...
 
Math::Vector Math::NormalToPlane (const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3)
 Returns the normal vector to a plane. More...
 
Math::Vector Math::SegmentPoint (const Math::Vector &p1, const Math::Vector &p2, float dist)
 Returns a point on the line p1 - p2, in dist distance from p1. More...
 
float Math::DistanceToPlane (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, const Math::Vector &p)
 Returns the distance between given point and a plane. More...
 
bool Math::IsSamePlane (const Math::Vector(&plane1)[3], const Math::Vector(&plane2)[3])
 Checks if two planes defined by three points are the same. More...
 
bool Math::Intersect (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, const Math::Vector &d, const Math::Vector &e, Math::Vector &i)
 Calculates the intersection "i" right "of" the plane "abc" (TODO: ?) More...
 
bool Math::IntersectY (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, Math::Vector &p)
 Calculates the intersection of the straight line passing through p (x, z) More...
 
Math::Vector Math::LookatPoint (const Math::Vector &eye, float angleH, float angleV, float length)
 Calculates the end point. More...
 
Math::Vector Math::Transform (const Math::Matrix &m, const Math::Vector &p)
 Transforms the point p by matrix m. More...
 
Math::Vector Math::Projection (const Math::Vector &a, const Math::Vector &b, const Math::Vector &p)
 Calculates the projection of the point p on a straight line a to b. More...
 
Math::Vector Math::RotateView (Math::Vector center, float angleH, float angleV, float dist)
 Calculates point of view to look at a center two angles and a distance. More...
 

Detailed Description

Math functions related to 3D geometry calculations, transformations, etc.