0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / BRepFill / BRepFill_DraftLaw.cxx
CommitLineData
b311480e 1// Created on: 1998-01-14
2// Created by: Philippe MANGIN
3// Copyright (c) 1998-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#include <BRepFill_DraftLaw.ixx>
24
25#include <GeomFill_LocationDraft.hxx>
26#include <GeomFill_LocationLaw.hxx>
27#include <GeomFill_HArray1OfLocationLaw.hxx>
28
29#include <gp_Vec.hxx>
30#include <gp_Mat.hxx>
31#include <gp_XYZ.hxx>
32#include <gp_Trsf.hxx>
33
34
35//=======================================================================
36//function : ToG0
37//purpose : Cacul une tranformation T tq T.M2 = M1
38//=======================================================================
39
40static void ToG0(const gp_Mat& M1, const gp_Mat& M2, gp_Mat& T) {
41 T = M2.Inverted();
42 T *= M1;
43}
44
45
46 BRepFill_DraftLaw::BRepFill_DraftLaw(const TopoDS_Wire & Path,
47 const Handle(GeomFill_LocationDraft) & Law)
48 :BRepFill_Edge3DLaw(Path, Law)
49{
50}
51
52 void BRepFill_DraftLaw::CleanLaw(const Standard_Real TolAngular)
53{
54 Standard_Real First, Last;//, Angle;
55 Standard_Integer ipath;
56 gp_Mat Trsf, M1, M2;
57 gp_Vec V, T1, T2, N1, N2;
58// gp_Dir D;
59
60 myLaws->Value(1)->GetDomain(First, Last);
61// D = Handle(GeomFill_LocationDraft)::DownCast(myLaws->Value(1))->Direction();
62// gp_Vec Vd(D);
63
64 for (ipath=2; ipath<=myLaws->Length(); ipath++) {
65 myLaws->Value(ipath-1)->D0(Last, M1, V);
66 myLaws->Value(ipath)->GetDomain(First, Last);
67 myLaws->Value(ipath)->D0(First, M2, V);
68 T1.SetXYZ(M1.Column(3));
69 T2.SetXYZ(M2.Column(3));
70 N1.SetXYZ(M1.Column(1));
71 N2.SetXYZ(M2.Column(1));
72 if (N1.IsParallel(N2, TolAngular)) { // Correction G0 des normales...
73 ToG0(M1, M2, Trsf);
74 myLaws->Value(ipath)->SetTrsf(Trsf);
75 }
76 }
77}