1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
16 #include <Vrml_OrthographicCamera.hxx>
17 #include <Vrml_SFRotation.hxx>
19 Vrml_OrthographicCamera::Vrml_OrthographicCamera():
27 Vrml_SFRotation tmpSFR(0,0,1,0);
28 myOrientation = tmpSFR;
31 Vrml_OrthographicCamera::Vrml_OrthographicCamera( const gp_Vec& aPosition,
32 const Vrml_SFRotation& aOrientation,
33 const Standard_Real aFocalDistance,
34 const Standard_Real aHeight)
36 myPosition = aPosition;
37 myOrientation = aOrientation;
38 myFocalDistance = aFocalDistance;
42 void Vrml_OrthographicCamera::SetPosition(const gp_Vec& aPosition)
44 myPosition = aPosition;
47 gp_Vec Vrml_OrthographicCamera::Position() const
52 void Vrml_OrthographicCamera::SetOrientation(const Vrml_SFRotation& aOrientation)
54 myOrientation = aOrientation;
57 Vrml_SFRotation Vrml_OrthographicCamera::Orientation() const
62 void Vrml_OrthographicCamera::SetFocalDistance(const Standard_Real aFocalDistance)
64 myFocalDistance = aFocalDistance;
67 Standard_Real Vrml_OrthographicCamera::FocalDistance() const
69 return myFocalDistance;
72 void Vrml_OrthographicCamera::SetHeight(const Standard_Real aHeight)
77 Standard_Real Vrml_OrthographicCamera::Height() const
82 Standard_OStream& Vrml_OrthographicCamera::Print(Standard_OStream& anOStream) const
84 anOStream << "OrthographicCamera {\n";
85 if ( Abs(myPosition.X() - 0) > 0.0001 ||
86 Abs(myPosition.Y() - 0) > 0.0001 ||
87 Abs(myPosition.Z() - 1) > 0.0001 )
89 anOStream << " position\t\t";
90 anOStream << myPosition.X() << " " << myPosition.Y() << " " << myPosition.Z() << "\n";
93 if ( Abs(myOrientation.RotationX() - 0) > 0.0001 ||
94 Abs(myOrientation.RotationY() - 0) > 0.0001 ||
95 Abs(myOrientation.RotationZ() - 1) > 0.0001 ||
96 Abs(myOrientation.Angle() - 0) > 0.0001 )
98 anOStream << " orientation\t\t";
99 anOStream << myOrientation.RotationX() << " " << myOrientation.RotationY() << " ";
100 anOStream << myOrientation.RotationZ() << " " << myOrientation.Angle() << "\n";
103 if ( Abs(myFocalDistance - 5) > 0.0001 )
105 anOStream << " focalDistance\t";
106 anOStream << myFocalDistance << "\n";
108 if ( Abs(myHeight - 2) > 0.0001 )
110 anOStream << " height\t\t";
111 anOStream << myHeight << "\n";