1 // Created on: 2015-06-18
2 // Created by: Anton POLETAEV
3 // Copyright (c) 2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Graphic3d_TransformPers_HeaderFile
17 #define _Graphic3d_TransformPers_HeaderFile
19 #include <Aspect_TypeOfTriedronPosition.hxx>
20 #include <Bnd_Box.hxx>
21 #include <BVH_Box.hxx>
22 #include <Graphic3d_Camera.hxx>
23 #include <Graphic3d_TransformUtils.hxx>
24 #include <Graphic3d_TransModeFlags.hxx>
25 #include <Graphic3d_Vec.hxx>
26 #include <NCollection_Mat4.hxx>
28 DEFINE_STANDARD_HANDLE(Graphic3d_TransformPers, Standard_Transient)
30 //! Transformation Persistence definition.
32 //! Transformation Persistence defines a mutable Local Coordinate system which depends on camera position,
33 //! so that visual appearance of the object becomes partially immutable while camera moves.
34 //! Object visually preserves particular property such as size, placement, rotation or their combination.
36 //! Graphic3d_TMF_ZoomPers, Graphic3d_TMF_RotatePers and Graphic3d_TMF_ZoomRotatePers define Local Coordinate system
37 //! having origin in specified anchor point defined in World Coordinate system,
38 //! while Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d define origin as 2D offset from screen corner in pixels.
40 //! Graphic3d_TMF_2d, Graphic3d_TMF_TriedronPers and Graphic3d_TMF_ZoomPers defines Local Coordinate system where length units are pixels.
41 //! Beware that Graphic3d_RenderingParams::ResolutionRatio() will be ignored!
42 //! For other Persistence flags, normal (world) length units will apply.
44 //! WARNING: Graphic3d_TMF_None is not permitted for defining instance of this class - NULL handle should be used for this purpose!
45 class Graphic3d_TransformPers : public Standard_Transient
47 DEFINE_STANDARD_RTTIEXT(Graphic3d_TransformPers, Standard_Transient)
50 //! Return true if specified mode is zoom/rotate transformation persistence.
51 static Standard_Boolean IsZoomOrRotate (Graphic3d_TransModeFlags theMode)
53 return (theMode & (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers)) != 0;
56 //! Return true if specified mode is 2d/trihedron transformation persistence.
57 static Standard_Boolean IsTrihedronOr2d (Graphic3d_TransModeFlags theMode)
59 return (theMode & (Graphic3d_TMF_TriedronPers | Graphic3d_TMF_2d)) != 0;
62 //! Create Graphic3d_TransformPers instance from deprecated parameters set
63 //! decoding 2D corner + offset parameters from 3D point.
64 Standard_EXPORT static Handle(Graphic3d_TransformPers) FromDeprecatedParams (Graphic3d_TransModeFlags theFlag,
65 const gp_Pnt& thePoint);
69 //! Set transformation persistence.
70 Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode)
73 if (IsZoomOrRotate (theMode))
75 SetPersistence (theMode, gp_Pnt(0.0, 0.0, 0.0));
77 else if (IsTrihedronOr2d (theMode))
79 SetPersistence (theMode, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (0, 0));
83 throw Standard_ProgramError("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
87 //! Set Zoom/Rotate transformation persistence with an anchor 3D point.
88 //! Anchor point defines the origin of Local Coordinate system within World Coordinate system.
89 //! Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
90 Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode,
92 : myMode (Graphic3d_TMF_None)
94 SetPersistence (theMode, thePnt);
97 //! Set 2d/trihedron transformation persistence with a corner and 2D offset.
98 //! 2D offset defines the origin of Local Coordinate system as projection of 2D point on screen plane into World Coordinate system.
99 //! Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.
100 //! The offset is a positive displacement from the view corner in pixels.
101 Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode,
102 const Aspect_TypeOfTriedronPosition theCorner,
103 const Graphic3d_Vec2i& theOffset = Graphic3d_Vec2i (0, 0))
104 : myMode (Graphic3d_TMF_None)
106 SetPersistence (theMode, theCorner, theOffset);
109 //! Return true for Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers modes.
110 Standard_Boolean IsZoomOrRotate() const { return IsZoomOrRotate (myMode); }
112 //! Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.
113 Standard_Boolean IsTrihedronOr2d() const { return IsTrihedronOr2d (myMode); }
115 //! Transformation persistence mode flags.
116 Graphic3d_TransModeFlags Mode() const { return myMode; }
118 //! Transformation persistence mode flags.
119 Graphic3d_TransModeFlags Flags() const { return myMode; }
121 //! Set Zoom/Rotate transformation persistence with an anchor 3D point.
122 //! Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
123 void SetPersistence (const Graphic3d_TransModeFlags theMode,
124 const gp_Pnt& thePnt)
126 if (!IsZoomOrRotate (theMode))
128 throw Standard_ProgramError("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
132 myParams.Params3d.PntX = thePnt.X();
133 myParams.Params3d.PntY = thePnt.Y();
134 myParams.Params3d.PntZ = thePnt.Z();
137 //! Set 2d/trihedron transformation persistence with a corner and 2D offset.
138 //! Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.
139 void SetPersistence (const Graphic3d_TransModeFlags theMode,
140 const Aspect_TypeOfTriedronPosition theCorner,
141 const Graphic3d_Vec2i& theOffset)
143 if (!IsTrihedronOr2d (theMode))
145 throw Standard_ProgramError("Graphic3d_TransformPers::SetPersistence(), wrong persistence mode.");
149 myParams.Params2d.Corner = theCorner;
150 myParams.Params2d.OffsetX = theOffset.x();
151 myParams.Params2d.OffsetY = theOffset.y();
156 //! Return the anchor point for zoom/rotate transformation persistence.
157 gp_Pnt AnchorPoint() const
159 if (!IsZoomOrRotate())
161 throw Standard_ProgramError("Graphic3d_TransformPers::AnchorPoint(), wrong persistence mode.");
164 return gp_Pnt (myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ);
167 //! Set the anchor point for zoom/rotate transformation persistence.
168 void SetAnchorPoint (const gp_Pnt& thePnt)
170 if (!IsZoomOrRotate())
172 throw Standard_ProgramError("Graphic3d_TransformPers::SetAnchorPoint(), wrong persistence mode.");
175 myParams.Params3d.PntX = thePnt.X();
176 myParams.Params3d.PntY = thePnt.Y();
177 myParams.Params3d.PntZ = thePnt.Z();
180 //! Return the corner for 2d/trihedron transformation persistence.
181 Aspect_TypeOfTriedronPosition Corner2d() const
183 if (!IsTrihedronOr2d())
185 throw Standard_ProgramError("Graphic3d_TransformPers::Corner2d(), wrong persistence mode.");
188 return myParams.Params2d.Corner;
191 //! Set the corner for 2d/trihedron transformation persistence.
192 void SetCorner2d (const Aspect_TypeOfTriedronPosition thePos)
194 if (!IsTrihedronOr2d())
196 throw Standard_ProgramError("Graphic3d_TransformPers::SetCorner2d(), wrong persistence mode.");
199 myParams.Params2d.Corner = thePos;
202 //! Return the offset from the corner for 2d/trihedron transformation persistence.
203 Graphic3d_Vec2i Offset2d() const
205 if (!IsTrihedronOr2d())
207 throw Standard_ProgramError("Graphic3d_TransformPers::Offset2d(), wrong persistence mode.");
210 return Graphic3d_Vec2i (myParams.Params2d.OffsetX, myParams.Params2d.OffsetY);
213 //! Set the offset from the corner for 2d/trihedron transformation persistence.
214 void SetOffset2d (const Graphic3d_Vec2i& theOffset)
216 if (!IsTrihedronOr2d())
218 throw Standard_ProgramError("Graphic3d_TransformPers::SetOffset2d(), wrong persistence mode.");
221 myParams.Params2d.OffsetX = theOffset.x();
222 myParams.Params2d.OffsetY = theOffset.y();
227 //! Apply transformation to bounding box of presentation.
228 //! @param theCamera [in] camera definition
229 //! @param theProjection [in] the projection transformation matrix.
230 //! @param theWorldView [in] the world view transformation matrix.
231 //! @param theViewportWidth [in] the width of viewport (for 2d persistence).
232 //! @param theViewportHeight [in] the height of viewport (for 2d persistence).
233 //! @param theBoundingBox [in/out] the bounding box to transform.
235 void Apply (const Handle(Graphic3d_Camera)& theCamera,
236 const NCollection_Mat4<T>& theProjection,
237 const NCollection_Mat4<T>& theWorldView,
238 const Standard_Integer theViewportWidth,
239 const Standard_Integer theViewportHeight,
240 Bnd_Box& theBoundingBox) const;
242 //! Apply transformation to bounding box of presentation
243 //! @param theCamera [in] camera definition
244 //! @param theProjection [in] the projection transformation matrix.
245 //! @param theWorldView [in] the world view transformation matrix.
246 //! @param theViewportWidth [in] the width of viewport (for 2d persistence).
247 //! @param theViewportHeight [in] the height of viewport (for 2d persistence).
248 //! @param theBoundingBox [in/out] the bounding box to transform.
250 void Apply (const Handle(Graphic3d_Camera)& theCamera,
251 const NCollection_Mat4<T>& theProjection,
252 const NCollection_Mat4<T>& theWorldView,
253 const Standard_Integer theViewportWidth,
254 const Standard_Integer theViewportHeight,
255 BVH_Box<T, 3>& theBoundingBox) const;
257 //! Compute transformation.
258 //! Computed matrix can be applied to model world transformation
259 //! of an object to implement effect of transformation persistence.
260 //! @param theCamera [in] camera definition
261 //! @param theProjection [in] the projection transformation matrix.
262 //! @param theWorldView [in] the world view transformation matrix.
263 //! @param theViewportWidth [in] the width of viewport (for 2d persistence).
264 //! @param theViewportHeight [in] the height of viewport (for 2d persistence).
265 //! @return transformation matrix to be applied to model world transformation of an object.
267 NCollection_Mat4<T> Compute (const Handle(Graphic3d_Camera)& theCamera,
268 const NCollection_Mat4<T>& theProjection,
269 const NCollection_Mat4<T>& theWorldView,
270 const Standard_Integer theViewportWidth,
271 const Standard_Integer theViewportHeight) const;
273 //! Apply transformation persistence on specified matrices.
274 //! @param theCamera camera definition
275 //! @param theProjection projection matrix to modify
276 //! @param theWorldView world-view matrix to modify
277 //! @param theViewportWidth viewport width
278 //! @param theViewportHeight viewport height
280 void Apply (const Handle(Graphic3d_Camera)& theCamera,
281 const NCollection_Mat4<T>& theProjection,
282 NCollection_Mat4<T>& theWorldView,
283 const Standard_Integer theViewportWidth,
284 const Standard_Integer theViewportHeight) const;
288 //! 3D anchor point for zoom/rotate transformation persistence.
296 //! 2d/trihedron transformation persistence parameters.
299 Standard_Integer OffsetX;
300 Standard_Integer OffsetY;
301 Aspect_TypeOfTriedronPosition Corner;
306 Graphic3d_TransModeFlags myMode; //!< Transformation persistence mode flags
309 PersParams3d Params3d;
310 PersParams2d Params2d;
315 // =======================================================================
317 // purpose : Apply transformation to world view and projection matrices.
318 // =======================================================================
320 void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
321 const NCollection_Mat4<T>& theProjection,
322 NCollection_Mat4<T>& theWorldView,
323 const Standard_Integer theViewportWidth,
324 const Standard_Integer theViewportHeight) const
326 (void )theViewportWidth;
327 (void )theProjection;
328 if (myMode == Graphic3d_TMF_None
329 || theViewportHeight == 0)
334 // use total size when tiling is active
335 const Standard_Integer aVPSizeY = theCamera->Tile().IsValid() ? theCamera->Tile().TotalSize.y() : theViewportHeight;
337 // a small enough jitter compensation offset
338 // to avoid image dragging within single pixel in corner cases
339 const Standard_Real aJitterComp = 0.001;
340 if (myMode == Graphic3d_TMF_TriedronPers)
342 // reset Z focus for trihedron persistence
343 const Standard_Real aFocus = theCamera->IsOrthographic()
344 ? theCamera->Distance()
345 : (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
346 ? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
347 : Standard_Real(theCamera->ZFocus()));
349 // scale factor to pixels
350 const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
351 const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
352 const gp_Dir aForward = theCamera->Direction();
353 gp_XYZ aCenter = theCamera->Center().XYZ() + aForward.XYZ() * (aFocus - theCamera->Distance());
354 if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
356 const Standard_Real anOffsetX = (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale;
357 const gp_Dir aSide = aForward.Crossed (theCamera->Up());
358 const gp_XYZ aDeltaX = aSide.XYZ() * (Abs(aViewDim.X()) * 0.5 - anOffsetX);
359 if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
368 if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
370 const Standard_Real anOffsetY = (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale;
371 const gp_XYZ aDeltaY = theCamera->Up().XYZ() * (Abs(aViewDim.Y()) * 0.5 - anOffsetY);
372 if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
382 NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
383 Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z());
384 Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
385 theWorldView.ConvertFrom (aWorldView);
388 else if (myMode == Graphic3d_TMF_2d)
390 const Standard_Real aFocus = theCamera->IsOrthographic()
391 ? theCamera->Distance()
392 : (theCamera->ZFocusType() == Graphic3d_Camera::FocusType_Relative
393 ? Standard_Real(theCamera->ZFocus() * theCamera->Distance())
394 : Standard_Real(theCamera->ZFocus()));
396 // scale factor to pixels
397 const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
398 const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
399 gp_XYZ aCenter (0.0, 0.0, -aFocus);
400 if ((myParams.Params2d.Corner & (Aspect_TOTP_LEFT | Aspect_TOTP_RIGHT)) != 0)
402 aCenter.SetX (-aViewDim.X() * 0.5 + (Standard_Real(myParams.Params2d.OffsetX) + aJitterComp) * aScale);
403 if ((myParams.Params2d.Corner & Aspect_TOTP_RIGHT) != 0)
405 aCenter.SetX (-aCenter.X());
408 if ((myParams.Params2d.Corner & (Aspect_TOTP_TOP | Aspect_TOTP_BOTTOM)) != 0)
410 aCenter.SetY (-aViewDim.Y() * 0.5 + (Standard_Real(myParams.Params2d.OffsetY) + aJitterComp) * aScale);
411 if ((myParams.Params2d.Corner & Aspect_TOTP_TOP) != 0)
413 aCenter.SetY (-aCenter.Y());
417 theWorldView.InitIdentity();
418 Graphic3d_TransformUtils::Translate (theWorldView, T(aCenter.X()), T(aCenter.Y()), T(aCenter.Z()));
419 Graphic3d_TransformUtils::Scale (theWorldView, T(aScale), T(aScale), T(aScale));
424 // Compute reference point for transformation in untransformed projection space.
425 NCollection_Mat4<Standard_Real> aWorldView = theCamera->OrientationMatrix();
426 Graphic3d_TransformUtils::Translate (aWorldView, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ);
427 if ((myMode & Graphic3d_TMF_RotatePers) != 0)
429 // lock rotation by nullifying rotation component
430 aWorldView.SetValue (0, 0, 1.0);
431 aWorldView.SetValue (1, 0, 0.0);
432 aWorldView.SetValue (2, 0, 0.0);
434 aWorldView.SetValue (0, 1, 0.0);
435 aWorldView.SetValue (1, 1, 1.0);
436 aWorldView.SetValue (2, 1, 0.0);
438 aWorldView.SetValue (0, 2, 0.0);
439 aWorldView.SetValue (1, 2, 0.0);
440 aWorldView.SetValue (2, 2, 1.0);
443 if ((myMode & Graphic3d_TMF_ZoomPers) != 0)
446 gp_Vec aVecToEye (theCamera->Direction());
447 gp_Vec aVecToObj (theCamera->Eye(), gp_Pnt (myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ));
448 const Standard_Real aFocus = aVecToObj.Dot (aVecToEye);
449 const gp_XYZ aViewDim = theCamera->ViewDimensions (aFocus);
450 const Standard_Real aScale = Abs(aViewDim.Y()) / Standard_Real(aVPSizeY);
451 Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale);
453 theWorldView.ConvertFrom (aWorldView);
458 // =======================================================================
460 // purpose : Apply transformation to bounding box of presentation.
461 // =======================================================================
463 void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
464 const NCollection_Mat4<T>& theProjection,
465 const NCollection_Mat4<T>& theWorldView,
466 const Standard_Integer theViewportWidth,
467 const Standard_Integer theViewportHeight,
468 Bnd_Box& theBoundingBox) const
470 if (theBoundingBox.IsVoid())
475 T aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
477 theBoundingBox.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
479 typename BVH_Box<T, 3>::BVH_VecNt aMin (aXmin, aYmin, aZmin);
480 typename BVH_Box<T, 3>::BVH_VecNt aMax (aXmax, aYmax, aZmax);
481 BVH_Box<T, 3> aBBox (aMin, aMax);
483 Apply (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight, aBBox);
485 theBoundingBox = Bnd_Box();
486 theBoundingBox.Update (aBBox.CornerMin().x(), aBBox.CornerMin().y(), aBBox.CornerMin().z(),
487 aBBox.CornerMax().x(), aBBox.CornerMax().y(), aBBox.CornerMax().z());
490 // =======================================================================
492 // purpose : Apply transformation to bounding box of presentation.
493 // =======================================================================
495 void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
496 const NCollection_Mat4<T>& theProjection,
497 const NCollection_Mat4<T>& theWorldView,
498 const Standard_Integer theViewportWidth,
499 const Standard_Integer theViewportHeight,
500 BVH_Box<T, 3>& theBoundingBox) const
502 NCollection_Mat4<T> aTPers = Compute (theCamera, theProjection, theWorldView, theViewportWidth, theViewportHeight);
503 if (aTPers.IsIdentity()
504 || !theBoundingBox.IsValid())
509 const typename BVH_Box<T, 3>::BVH_VecNt& aMin = theBoundingBox.CornerMin();
510 const typename BVH_Box<T, 3>::BVH_VecNt& aMax = theBoundingBox.CornerMax();
512 typename BVH_Box<T, 4>::BVH_VecNt anArrayOfCorners[8];
513 anArrayOfCorners[0] = typename BVH_Box<T, 4>::BVH_VecNt (aMin.x(), aMin.y(), aMin.z(), static_cast<T> (1.0));
514 anArrayOfCorners[1] = typename BVH_Box<T, 4>::BVH_VecNt (aMin.x(), aMin.y(), aMax.z(), static_cast<T> (1.0));
515 anArrayOfCorners[2] = typename BVH_Box<T, 4>::BVH_VecNt (aMin.x(), aMax.y(), aMin.z(), static_cast<T> (1.0));
516 anArrayOfCorners[3] = typename BVH_Box<T, 4>::BVH_VecNt (aMin.x(), aMax.y(), aMax.z(), static_cast<T> (1.0));
517 anArrayOfCorners[4] = typename BVH_Box<T, 4>::BVH_VecNt (aMax.x(), aMin.y(), aMin.z(), static_cast<T> (1.0));
518 anArrayOfCorners[5] = typename BVH_Box<T, 4>::BVH_VecNt (aMax.x(), aMin.y(), aMax.z(), static_cast<T> (1.0));
519 anArrayOfCorners[6] = typename BVH_Box<T, 4>::BVH_VecNt (aMax.x(), aMax.y(), aMin.z(), static_cast<T> (1.0));
520 anArrayOfCorners[7] = typename BVH_Box<T, 4>::BVH_VecNt (aMax.x(), aMax.y(), aMax.z(), static_cast<T> (1.0));
522 theBoundingBox.Clear();
523 for (Standard_Integer anIt = 0; anIt < 8; ++anIt)
525 typename BVH_Box<T, 4>::BVH_VecNt& aCorner = anArrayOfCorners[anIt];
526 aCorner = aTPers * aCorner;
527 aCorner = aCorner / aCorner.w();
528 theBoundingBox.Add (typename BVH_Box<T, 3>::BVH_VecNt (aCorner.x(), aCorner.y(), aCorner.z()));
532 // =======================================================================
533 // function : Compute
534 // purpose : Compute transformation.
535 // =======================================================================
537 NCollection_Mat4<T> Graphic3d_TransformPers::Compute (const Handle(Graphic3d_Camera)& theCamera,
538 const NCollection_Mat4<T>& theProjection,
539 const NCollection_Mat4<T>& theWorldView,
540 const Standard_Integer theViewportWidth,
541 const Standard_Integer theViewportHeight) const
543 if (myMode == Graphic3d_TMF_None)
545 return NCollection_Mat4<T>();
548 NCollection_Mat4<T> aWorldView (theWorldView);
549 NCollection_Mat4<T> anUnviewMat;
550 if (!theWorldView.Inverted (anUnviewMat))
552 return NCollection_Mat4<T>();
555 // compute only world-view matrix difference to avoid floating point instability
556 // caused by projection matrix modifications outside of this algorithm (e.g. by Z-fit)
557 Apply (theCamera, theProjection, aWorldView, theViewportWidth, theViewportHeight);
558 return anUnviewMat * aWorldView;
561 #endif // _Graphic3d_TransformPers_HeaderFile