summaryrefslogtreecommitdiff
path: root/src/Intf/Intf.cxx
blob: 99e8ddc4ca0d966255ee4f37dd95ae5d7ecf9428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// File:	Intf.cxx
// Created:	Wed Jan 20 11:41:33 1993
// Author:	Didier PIFFAULT
//		<dpf@phylox>

#include <Intf.ixx>

//=======================================================================
//function : PlaneEquation
//purpose  : 
//=======================================================================

void Intf::PlaneEquation (const gp_Pnt&  P1,
			  const gp_Pnt&  P2,
			  const gp_Pnt&  P3,
			  gp_XYZ&        NormalVector,
			  Standard_Real& PolarDistance)
{
  gp_XYZ v1=P2.XYZ()-P1.XYZ();
  gp_XYZ v2=P3.XYZ()-P2.XYZ();
  gp_XYZ v3=P1.XYZ()-P3.XYZ();
  NormalVector= (v1^v2)+(v2^v3)+(v3^v1);
  NormalVector.Normalize();
  PolarDistance = NormalVector * P1.XYZ();
}


//=======================================================================
//function : Contain
//purpose  : 
//=======================================================================

Standard_Boolean Intf::Contain (const gp_Pnt&  P1,
				const gp_Pnt&  P2,
				const gp_Pnt&  P3,
				const gp_Pnt& ThePnt)
{
  gp_XYZ v1=(P2.XYZ()-P1.XYZ())^(ThePnt.XYZ()-P1.XYZ());
  gp_XYZ v2=(P3.XYZ()-P2.XYZ())^(ThePnt.XYZ()-P2.XYZ());
  gp_XYZ v3=(P1.XYZ()-P3.XYZ())^(ThePnt.XYZ()-P3.XYZ());
  if (v1*v2 >= 0. && v2*v3 >= 0. && v3*v1>=0.) return Standard_True;
  else                                         return Standard_False;
}