예제 #1
0
파일: geometry.c 프로젝트: MacounDe/2011
void planeFromPoints(const vec3* a, const vec3* b, const vec3* c, plane3* p) {
	vec3 d1, d2;
	sub(a,b,&d1);
	sub (b,c,&d2);
	crossProduct(&d1,&d2,&(p->n));
	normalize(&(p->n));
	p->d = 0.0;
	p->d = -signedDistance(a,p);
}
예제 #2
0
Scalar Plane<Scalar>::distance(const Vector<Scalar,3> &point) const
{
    Scalar signed_dist = signedDistance(point);
    Scalar dist = signed_dist>=0?signed_dist:-signed_dist;
    return dist;
}
예제 #3
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /** Reflect a point in the hyperplane. */
 VectorT reflect(VectorT const & p) const
 {
   return p - 2 * signedDistance(p) * normal;
 }
예제 #4
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /**
  * Check if the negative half space (the side of the hyperplane <b>not</b> containing the normal) contains a given point.
  * Returns true if the point lies on the hyperplane.
  */
 bool negativeHalfSpaceContains(VectorT const & p) const
 {
   return signedDistance(p) <= 0;
 }
예제 #5
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /**
  * Check if the positive half space (the side of the hyperplane containing the normal) contains a given point. Returns true
  * if the point lies on the hyperplane.
  */
 bool positiveHalfSpaceContains(VectorT const & p) const
 {
   return signedDistance(p) >= 0;
 }
예제 #6
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /** Get the point on the hyperplane closest to a given point. */
 VectorT closestPoint(VectorT const & p) const
 {
   return p - signedDistance(p) * normal;
 }
예제 #7
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /** Get the square of the distance of the hyperplane from a given point. */
 T squaredDistance(VectorT const & p) const
 {
   return Math::square(signedDistance(p));
 }
예제 #8
0
파일: HyperplaneN.hpp 프로젝트: sidch/Thea
 /** Get the (unsigned) distance of a given point from the hyperplane. */
 T distance(VectorT const & p) const
 {
   return std::abs(signedDistance(p));
 }