0024157: Parallelization of assembly part of BO
[occt.git] / src / gce / gce_MakeDir.cxx
CommitLineData
b311480e 1// Created on: 1992-09-02
2// Created by: Remi GILET
3// Copyright (c) 1992-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#include <gce_MakeDir.ixx>
23#include <StdFail_NotDone.hxx>
24#include <gp.hxx>
25
26//=========================================================================
27// Creation d une direction 3d (Dir) de gp a partir de 2 Pnt de gp. +
28//=========================================================================
29
30gce_MakeDir::gce_MakeDir(const gp_Pnt& P1,
31 const gp_Pnt& P2)
32{
33 if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
34 else {
35 TheDir = gp_Dir(P2.XYZ()-P1.XYZ());
36 TheError = gce_Done;
37 }
38}
39
40gce_MakeDir::gce_MakeDir(const gp_XYZ& Coord)
41{
42 if (Coord.Modulus() <= gp::Resolution()) { TheError = gce_NullVector; }
43 else {
44 TheDir = gp_Dir(Coord);
45 TheError = gce_Done;
46 }
47}
48
49gce_MakeDir::gce_MakeDir(const gp_Vec& V)
50{
51 if (V.Magnitude() <= gp::Resolution()) { TheError = gce_NullVector; }
52 else {
53 TheDir = gp_Dir(V);
54 TheError = gce_Done;
55 }
56}
57
58gce_MakeDir::gce_MakeDir(const Standard_Real Xv,
59 const Standard_Real Yv,
60 const Standard_Real Zv)
61{
62 if (Xv*Xv+Yv*Yv+Zv*Zv <= gp::Resolution()) { TheError = gce_NullVector; }
63 else {
64 TheDir = gp_Dir(Xv,Yv,Zv);
65 TheError = gce_Done;
66 }
67}
68
69const gp_Dir& gce_MakeDir::Value() const
70{
71 StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
72 return TheDir;
73}
74
75const gp_Dir& gce_MakeDir::Operator() const
76{
77 return Value();
78}
79
80gce_MakeDir::operator gp_Dir() const
81{
82 return Value();
83}
84