// Created on: 1992-07-09 // Created by: Christophe MARION // Copyright (c) 1992-1999 Matra Datavision // Copyright (c) 1999-2012 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file // except in compliance with the License. Please obtain a copy of the License // at http://www.opencascade.org and read it completely before using this file. // // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // // The Original Code and all software distributed under the License is // distributed on an "AS IS" basis, without warranty of any kind, and the // Initial Developer hereby disclaims all such warranties, including without // limitation, any warranties of merchantability, fitness for a particular // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. #include #include #include #include #include #include //======================================================================= //function : Perspective //purpose : //======================================================================= inline Standard_Boolean Select3D_Projector::Perspective() const { return myPersp; } //======================================================================= //function : Transformation //purpose : //======================================================================= inline const gp_GTrsf& Select3D_Projector::Transformation() const { return myGTrsf; } //======================================================================= //function : InvertedTransformation //purpose : //======================================================================= inline const gp_GTrsf& Select3D_Projector::InvertedTransformation() const { return myInvTrsf; } //======================================================================= //function : FullTransformation //purpose : //======================================================================= inline const gp_Trsf& Select3D_Projector::FullTransformation() const { return myScaledTrsf; } //======================================================================= //function : Focus //purpose : //======================================================================= inline Standard_Real Select3D_Projector::Focus() const { Standard_NoSuchObject_Raise_if(!myPersp, "Select3D_Projector::Not a Perpective"); return myFocus; } //======================================================================= //function : Transform //purpose : //======================================================================= inline void Select3D_Projector::Transform (gp_Vec& D) const { gp_XYZ coord = D.XYZ(); if (myGTrsf.Form() == gp_Identity || myGTrsf.Form() == gp_Translation) { } else if (myGTrsf.Form() == gp_PntMirror) { coord.Reverse(); } else { coord.Multiply (myGTrsf.VectorialPart()); } D.SetXYZ(coord); } //======================================================================= //function : Transform //purpose : //======================================================================= inline void Select3D_Projector::Transform (gp_Pnt& Pnt) const { gp_XYZ xyz = Pnt.XYZ(); myGTrsf.Transforms(xyz); Pnt = gp_Pnt(xyz); } inline const Handle(V3d_View)& Select3D_Projector::View() const {return myView;} inline void Select3D_Projector::Transform (gp_Lin& Lin, const gp_GTrsf& T) const { gp_Ax1 ax1 = Lin.Position(); gp_XYZ xyz = ax1.Location().XYZ(); T.Transforms(xyz); ax1.SetLocation(gp_Pnt(xyz)); gp_Dir dir = ax1.Direction(); gp_XYZ coord = dir.XYZ(); if (T.Form() == gp_Identity || T.Form() == gp_Translation) { } else if (T.Form() == gp_PntMirror) { coord.Reverse(); } else { coord.Multiply (T.VectorialPart()); Standard_Real D = coord.Modulus(); coord.Divide(D); } dir.SetXYZ(coord); ax1.SetDirection(dir); Lin.SetPosition(ax1); } inline void Select3D_Projector::Transform (gp_Pnt& Pnt, const gp_GTrsf& T) const { gp_XYZ xyz = Pnt.XYZ(); T.Transforms(xyz); Pnt = gp_Pnt(xyz); } inline Standard_Real Select3D_Projector::DepthMin() const { return myDepthMin; } inline Standard_Real Select3D_Projector::DepthMax() const { return myDepthMax; }