MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlPlane.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2010, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_PLANE_H
14#define ML_PLANE_H
15
17
19#include "mlVector3.h"
20
22
24class Line;
25
26//----------------------------------------------------------------------------
28//----------------------------------------------------------------------------
30{
31
32public:
35
38 Plane(const Vector3& normal, MLdouble distance);
39
42 Plane(const Vector3& p0, const Vector3& p1, const Vector3& p2);
43
46 Plane(const Vector3& normal, const Vector3& point);
47
50
53 bool intersect(const Line& l, Vector3& intersection) const;
54
57 bool isInHalfSpace(const Vector3& point) const;
58
61
63 const Vector3& getNormal() const;
64
67 bool setNormal(const Vector3& n);
68
70 void setDistance(double d);
71
74 {
75 return _distance;
76 }
77
82 MLSign edgeIntersect(const Vector3& v1, const Vector3& v2, Vector3& intersectPos) const;
83
84private:
86 MLdouble _distance;
87
89 Vector3 _normal;
90};
91
93
94#endif // __mlPlane_H
Class to define the geometry primitive 'Line' consisting of a position and a direction.
Definition mlLine.h:28
Class defining a plane in 3D.
Definition mlPlane.h:30
Plane(const Vector3 &normal, MLdouble distance)
Constructs a plane from normal normal and distance from origin distance.
const Vector3 & getNormal() const
Returns the plane normal.
bool setNormal(const Vector3 &n)
Sets the plane normal to n (performing normalization), or (1, 0, 0) if n == 0.
MLdouble getDistance(const Vector3 &point) const
Returns the distance of point from plane.
bool intersect(const Line &l, Vector3 &intersection) const
Intersects this plane with line l and returns the intersection point in intersection.
Plane()
Constructor. Normal defaults to (0, 0, 1) and distance to 0.
bool isInHalfSpace(const Vector3 &point) const
Returns whether the point lies in the half-space of the plane into which the normal of the plane poin...
Plane(const Vector3 &normal, const Vector3 &point)
Constructs a plane from normal and point in space.
Vector3 getClosestPoint(const Vector3 &point) const
Projects a point onto this plane.
Plane(const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
Constructs a plane from three points in space.
void setDistance(double d)
Sets the distance from origin to d.
MLSign edgeIntersect(const Vector3 &v1, const Vector3 &v2, Vector3 &intersectPos) const
Determines whether an edge (line segment) bounded by v1 -> v2 intersects *this.
MLdouble getDistanceFromOrigin() const
Returns the minimum distance of plane from origin.
Definition mlPlane.h:73
#define ML_LINEAR_ALGEBRA_EXPORT
Defines all system specific settings for all linear algebra classes.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217
MLSign
Definition of possible signs as enumerator.