summaryrefslogtreecommitdiff
path: root/src/BRepPrimAPI/BRepPrimAPI_MakeCone.cxx
blob: 7ea495ec8cdc4382470183a43f22b39b681f9f69 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// File:	BRepPrimAPI_MakeCone.cxx
// Created:	Fri Jul 23 15:51:44 1993
// Author:	Remi LEQUETTE
//		<rle@nonox>


#include <BRepPrimAPI_MakeCone.ixx>
#include <BRepBuilderAPI.hxx>



#include <gp.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax2.hxx>


//-- lbr le 13 decembre 95
static gp_Ax2 ConeComputeAxes() { 
  static Standard_Integer firsttime=1;
  static Standard_Integer modif=0;
  static Standard_Real cosa=cos(0.122);
  static Standard_Real sina=sin(0.122);
  static Standard_Real ux=1.0;
  static Standard_Real uy=0.0;
  
  if(firsttime) { 
    modif = getenv("PRIM_CONE") != NULL;
    firsttime = 0;
  }
  if(modif) { 
    Standard_Real nux = cosa*ux+sina*uy;
    Standard_Real nuy =-sina*ux+cosa*uy;
    ux=nux; uy=nuy;
    return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
  }
  else { 
    return(gp::XOY());
  }
}



//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose  : 
//=======================================================================

BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1,
				   const Standard_Real R2, 
				   const Standard_Real H) :
       myCone(ConeComputeAxes(),R1, R2, H)
{
}


//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose  : 
//=======================================================================

BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1,
				   const Standard_Real R2,
				   const Standard_Real H,
				   const Standard_Real angle) :
       myCone( R1, R2, H)
{
  myCone.Angle(angle);
}


//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose  : 
//=======================================================================

BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes,
				   const Standard_Real R1, 
				   const Standard_Real R2,
				   const Standard_Real H) :
       myCone( Axes, R1, R2, H)
{
}


//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose  : 
//=======================================================================

BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes,
				   const Standard_Real R1,
				   const Standard_Real R2,
				   const Standard_Real H,
				   const Standard_Real angle) :
       myCone( Axes, R1, R2, H)
{
  myCone.Angle(angle);
}


//=======================================================================
//function : OneAxis
//purpose  : 
//=======================================================================

Standard_Address  BRepPrimAPI_MakeCone::OneAxis()
{
  return &myCone;
}


//=======================================================================
//function : Cone
//purpose  : 
//=======================================================================

BRepPrim_Cone&  BRepPrimAPI_MakeCone::Cone()
{
  return myCone;
}