MeVisLab Toolbox Reference
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
24 class Line;
25
26 //----------------------------------------------------------------------------
28 //----------------------------------------------------------------------------
30 {
31
32 public:
33
36
39 Plane(const Vector3& normal, MLdouble distance);
40
43 Plane(const Vector3& p0, const Vector3& p1, const Vector3& p2);
44
47 Plane(const Vector3& normal, const Vector3& point);
48
51
54 bool intersect(const Line& l, Vector3& intersection) const;
55
58 bool isInHalfSpace(const Vector3& point) const;
59
62
64 const Vector3& getNormal() const;
65
68 bool setNormal(const Vector3 &n);
69
71 void setDistance(double d);
72
74 inline MLdouble getDistanceFromOrigin() const { return _distance; }
75
81 const Vector3 &v2,
82 Vector3 &intersectPos) const;
83 private:
85 MLdouble _distance;
86
88 Vector3 _normal;
89 };
90
92
93#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:74
#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.