| 1 | -- File: Select3D_Projector.cdl |
| 2 | -- Created: Thu Mar 12 13:32:28 1992 |
| 3 | -- Author: Christophe MARION |
| 4 | -- <cma@sdsun2> copie quasi exacte de HLRAlgo_Projector |
| 5 | ---Copyright: Matra Datavision 1992 |
| 6 | |
| 7 | class Projector from Select3D |
| 8 | ---Purpose: A framework to define 3D projectors. |
| 9 | uses |
| 10 | Real from Standard, |
| 11 | Boolean from Standard, |
| 12 | Trsf from gp, |
| 13 | GTrsf from gp, |
| 14 | Lin from gp, |
| 15 | Pnt from gp, |
| 16 | Vec from gp, |
| 17 | Ax2 from gp, |
| 18 | Vec2d from gp, |
| 19 | Pnt2d from gp, |
| 20 | Box from Bnd, |
| 21 | View from V3d |
| 22 | |
| 23 | raises |
| 24 | NoSuchObject from Standard |
| 25 | |
| 26 | is |
| 27 | |
| 28 | Create(aView:View from V3d) returns Projector from Select3D; |
| 29 | --- Purpose: Constructs the 3D projector object defined by the 3D view aView. |
| 30 | Create returns Projector from Select3D; |
| 31 | |
| 32 | Create(CS : Ax2 from gp) |
| 33 | ---Purpose: Creates an axonometric projector. <CS> is the |
| 34 | -- viewing coordinate system. |
| 35 | returns Projector from Select3D; |
| 36 | |
| 37 | Create(CS : Ax2 from gp; |
| 38 | Focus : Real from Standard) |
| 39 | ---Purpose: Creates a perspective projector. <CS> is the |
| 40 | -- viewing coordinate system. |
| 41 | returns Projector from Select3D; |
| 42 | |
| 43 | Create(T : Trsf from gp; |
| 44 | Persp : Boolean from Standard; |
| 45 | Focus : Real from Standard) |
| 46 | ---Purpose: build a Projector with automatic minmax directions. |
| 47 | returns Projector from Select3D; |
| 48 | |
| 49 | Create(T : Trsf from gp; |
| 50 | Persp : Boolean from Standard; |
| 51 | Focus : Real from Standard; |
| 52 | v1,v2,v3 : Vec2d from gp) |
| 53 | ---Purpose: build a Projector with given minmax directions. |
| 54 | returns Projector from Select3D; |
| 55 | |
| 56 | Create(GT : GTrsf from gp; |
| 57 | Persp : Boolean from Standard; |
| 58 | Focus : Real from Standard) |
| 59 | ---Purpose: build a Projector with automatic minmax directions. |
| 60 | returns Projector from Select3D; |
| 61 | |
| 62 | Delete(me:out) is virtual; |
| 63 | ---C++: alias "Standard_EXPORT virtual ~Select3D_Projector(){Delete() ; }" |
| 64 | |
| 65 | Set (me: in out ; |
| 66 | T : Trsf from gp; |
| 67 | Persp : Boolean from Standard; |
| 68 | Focus : Real from Standard) |
| 69 | is static; |
| 70 | |
| 71 | |
| 72 | SetView(me:in out ; V : View from V3d); |
| 73 | ---Purpose: Sets the 3D view V used at the time of construction. |
| 74 | |
| 75 | View(me) returns any View from V3d; |
| 76 | ---Purpose: Returns the 3D view used at the time of construction. |
| 77 | ---C++: return const& |
| 78 | ---C++: inline |
| 79 | |
| 80 | |
| 81 | Directions(me; D1 , D2 , D3 : out Vec2d from gp) |
| 82 | ---C++: inline |
| 83 | is virtual; |
| 84 | |
| 85 | Scaled(me : in out; On : Boolean from Standard = Standard_False) |
| 86 | ---Purpose: to compute with the given scale and translation. |
| 87 | is virtual; |
| 88 | |
| 89 | Perspective(me) returns Boolean |
| 90 | ---Purpose: Returns True if there is a perspective transformation. |
| 91 | ---C++: inline |
| 92 | is virtual; |
| 93 | |
| 94 | Transformation(me) returns GTrsf from gp |
| 95 | ---Purpose: Returns the active transformation. |
| 96 | ---C++: inline |
| 97 | ---C++: return const & |
| 98 | is virtual; |
| 99 | |
| 100 | InvertedTransformation(me) returns GTrsf from gp |
| 101 | ---Purpose: Returns the active inverted transformation. |
| 102 | ---C++: inline |
| 103 | ---C++: return const & |
| 104 | is virtual; |
| 105 | |
| 106 | FullTransformation(me) returns Trsf from gp |
| 107 | ---Purpose: Returns the original transformation. |
| 108 | ---C++: inline |
| 109 | ---C++: return const & |
| 110 | is virtual; |
| 111 | |
| 112 | Focus(me) returns Real from Standard |
| 113 | ---Purpose: Returns the focal length. |
| 114 | ---C++: inline |
| 115 | raises |
| 116 | NoSuchObject from Standard -- if there is no perspective |
| 117 | is virtual; |
| 118 | |
| 119 | Transform(me; D : in out Vec from gp) |
| 120 | ---C++: inline |
| 121 | is virtual; |
| 122 | |
| 123 | Transform(me; Pnt : in out Pnt from gp) |
| 124 | ---C++: inline |
| 125 | is virtual; |
| 126 | |
| 127 | Project(me; P : Pnt from gp; |
| 128 | Pout : out Pnt2d from gp) |
| 129 | ---Purpose: Transform and apply perspective if needed. |
| 130 | is virtual; |
| 131 | |
| 132 | Project(me; P : Pnt from gp; |
| 133 | X,Y,Z : out Real from Standard) |
| 134 | ---Purpose: Transform and apply perspective if needed. |
| 135 | is static; |
| 136 | |
| 137 | Project(me; P : Pnt from gp; |
| 138 | D1 : Vec from gp; |
| 139 | Pout : out Pnt2d from gp; |
| 140 | D1out : out Vec2d from gp) |
| 141 | ---Purpose: Transform and apply perspective if needed. |
| 142 | is virtual; |
| 143 | |
| 144 | BoxAdd(me; P : Pnt2d from gp; |
| 145 | B : out Box from Bnd) |
| 146 | ---Purpose: Adds to the box <B> the min-max of the point <P>. |
| 147 | is virtual; |
| 148 | |
| 149 | Shoot(me; X , Y : Real from Standard) |
| 150 | returns Lin from gp |
| 151 | ---Purpose: return a line going through the eye towards the |
| 152 | -- 2d point <X,Y>. |
| 153 | is virtual; |
| 154 | |
| 155 | SetDirection(me: in out) |
| 156 | is static private; |
| 157 | |
| 158 | Transform(me; P : in out Pnt from gp; |
| 159 | T : GTrsf from gp) |
| 160 | ---C++: inline |
| 161 | is virtual; |
| 162 | |
| 163 | Transform(me; D : in out Lin from gp; |
| 164 | T : GTrsf from gp) |
| 165 | ---C++: inline |
| 166 | is virtual; |
| 167 | |
| 168 | fields |
| 169 | myType : Integer from Standard; |
| 170 | |
| 171 | myPersp : Boolean from Standard is protected; |
| 172 | myFocus : Real from Standard is protected; |
| 173 | myScaledTrsf : Trsf from gp is protected; |
| 174 | myGTrsf : GTrsf from gp is protected; |
| 175 | myInvTrsf : GTrsf from gp is protected; |
| 176 | myD1 : Vec2d from gp is protected; |
| 177 | myD2 : Vec2d from gp is protected; |
| 178 | myD3 : Vec2d from gp is protected; |
| 179 | |
| 180 | |
| 181 | myView : View from V3d; |
| 182 | |
| 183 | end Projector; |