Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BRepFill / BRepFill_DraftLaw.cxx
CommitLineData
7fd59977 1// File: BRepFill_DraftLaw.cxx
2// Created: Wed Jan 14 14:41:23 1998
3// Author: Philippe MANGIN
4// <pmn@sgi29>
5
6
7#include <BRepFill_DraftLaw.ixx>
8
9#include <GeomFill_LocationDraft.hxx>
10#include <GeomFill_LocationLaw.hxx>
11#include <GeomFill_HArray1OfLocationLaw.hxx>
12
13#include <gp_Vec.hxx>
14#include <gp_Mat.hxx>
15#include <gp_XYZ.hxx>
16#include <gp_Trsf.hxx>
17
18
19//=======================================================================
20//function : ToG0
21//purpose : Cacul une tranformation T tq T.M2 = M1
22//=======================================================================
23
24static void ToG0(const gp_Mat& M1, const gp_Mat& M2, gp_Mat& T) {
25 T = M2.Inverted();
26 T *= M1;
27}
28
29
30 BRepFill_DraftLaw::BRepFill_DraftLaw(const TopoDS_Wire & Path,
31 const Handle(GeomFill_LocationDraft) & Law)
32 :BRepFill_Edge3DLaw(Path, Law)
33{
34}
35
36 void BRepFill_DraftLaw::CleanLaw(const Standard_Real TolAngular)
37{
38 Standard_Real First, Last;//, Angle;
39 Standard_Integer ipath;
40 gp_Mat Trsf, M1, M2;
41 gp_Vec V, T1, T2, N1, N2;
42// gp_Dir D;
43
44 myLaws->Value(1)->GetDomain(First, Last);
45// D = Handle(GeomFill_LocationDraft)::DownCast(myLaws->Value(1))->Direction();
46// gp_Vec Vd(D);
47
48 for (ipath=2; ipath<=myLaws->Length(); ipath++) {
49 myLaws->Value(ipath-1)->D0(Last, M1, V);
50 myLaws->Value(ipath)->GetDomain(First, Last);
51 myLaws->Value(ipath)->D0(First, M2, V);
52 T1.SetXYZ(M1.Column(3));
53 T2.SetXYZ(M2.Column(3));
54 N1.SetXYZ(M1.Column(1));
55 N2.SetXYZ(M2.Column(1));
56 if (N1.IsParallel(N2, TolAngular)) { // Correction G0 des normales...
57 ToG0(M1, M2, Trsf);
58 myLaws->Value(ipath)->SetTrsf(Trsf);
59 }
60 }
61}