|
|
|||
File indexing completed on 2026-06-24 08:29:27
0001 // Created on: 1992-08-26 0002 // Created by: Jean Louis FRENKEL 0003 // Copyright (c) 1992-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Prs3d_HeaderFile 0018 #define _Prs3d_HeaderFile 0019 0020 #include <Graphic3d_ArrayOfPrimitives.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Prs3d_Drawer.hxx> 0023 #include <Prs3d_NListOfSequenceOfPnt.hxx> 0024 #include <Prs3d_Presentation.hxx> 0025 0026 class Poly_Triangulation; 0027 0028 //! The Prs3d package provides the following services 0029 //! - a presentation object (the context for all 0030 //! modifications to the display, its presentation will be 0031 //! displayed in every view of an active viewer) 0032 //! - an attribute manager governing how objects such 0033 //! as color, width, and type of line are displayed; 0034 //! these are generic objects, whereas those in 0035 //! StdPrs are specific geometries and topologies. 0036 //! - generic algorithms providing default settings for 0037 //! objects such as points, curves, surfaces and shapes 0038 //! - a root object which provides the abstract 0039 //! framework for the DsgPrs definitions at work in 0040 //! display of dimensions, relations and trihedra. 0041 class Prs3d 0042 { 0043 public: 0044 DEFINE_STANDARD_ALLOC 0045 0046 //! draws an arrow at a given location, with respect 0047 //! to a given direction. 0048 Standard_EXPORT static Standard_Boolean MatchSegment(const Standard_Real X, 0049 const Standard_Real Y, 0050 const Standard_Real Z, 0051 const Standard_Real aDistance, 0052 const gp_Pnt& p1, 0053 const gp_Pnt& p2, 0054 Standard_Real& dist); 0055 0056 //! Computes the absolute deflection value based on relative deflection 0057 //! Prs3d_Drawer::DeviationCoefficient(). 0058 //! @param[in] theBndMin bounding box min corner 0059 //! @param[in] theBndMax bounding box max corner 0060 //! @param[in] theDeviationCoefficient relative deflection coefficient from 0061 //! Prs3d_Drawer::DeviationCoefficient() 0062 //! @return absolute deflection coefficient based on bounding box dimensions 0063 static Standard_Real GetDeflection(const Graphic3d_Vec3d& theBndMin, 0064 const Graphic3d_Vec3d& theBndMax, 0065 const Standard_Real theDeviationCoefficient) 0066 { 0067 const Graphic3d_Vec3d aDiag = theBndMax - theBndMin; 0068 return Max(aDiag.maxComp() * theDeviationCoefficient * 4.0, Precision::Confusion()); 0069 } 0070 0071 //! Computes the absolute deflection value based on relative deflection 0072 //! Prs3d_Drawer::DeviationCoefficient(). 0073 //! @param[in] theBndBox bounding box 0074 //! @param[in] theDeviationCoefficient relative deflection coefficient from 0075 //! Prs3d_Drawer::DeviationCoefficient() 0076 //! @param[in] theMaximalChordialDeviation absolute deflection coefficient from 0077 //! Prs3d_Drawer::MaximalChordialDeviation() 0078 //! @return absolute deflection coefficient based on bounding box dimensions or 0079 //! theMaximalChordialDeviation if bounding box is Void or Infinite 0080 static Standard_Real GetDeflection(const Bnd_Box& theBndBox, 0081 const Standard_Real theDeviationCoefficient, 0082 const Standard_Real theMaximalChordialDeviation) 0083 { 0084 if (theBndBox.IsVoid()) 0085 { 0086 return theMaximalChordialDeviation; 0087 } 0088 0089 Bnd_Box aBndBox = theBndBox; 0090 if (theBndBox.IsOpen()) 0091 { 0092 if (!theBndBox.HasFinitePart()) 0093 { 0094 return theMaximalChordialDeviation; 0095 } 0096 aBndBox = theBndBox.FinitePart(); 0097 } 0098 0099 Graphic3d_Vec3d aVecMin, aVecMax; 0100 aBndBox.Get(aVecMin.x(), aVecMin.y(), aVecMin.z(), aVecMax.x(), aVecMax.y(), aVecMax.z()); 0101 return GetDeflection(aVecMin, aVecMax, theDeviationCoefficient); 0102 } 0103 0104 //! Assembles array of primitives for sequence of polylines. 0105 //! @param[in] thePoints the polylines sequence 0106 //! @return array of primitives 0107 Standard_EXPORT static Handle(Graphic3d_ArrayOfPrimitives) PrimitivesFromPolylines( 0108 const Prs3d_NListOfSequenceOfPnt& thePoints); 0109 0110 //! Add primitives into new group in presentation and clear the list of polylines. 0111 Standard_EXPORT static void AddPrimitivesGroup(const Handle(Prs3d_Presentation)& thePrs, 0112 const Handle(Prs3d_LineAspect)& theAspect, 0113 Prs3d_NListOfSequenceOfPnt& thePolylines); 0114 0115 //! Add triangulation free edges into sequence of line segments. 0116 //! @param[out] theSegments sequence of line segments to fill 0117 //! @param[in] thePolyTri triangulation to process 0118 //! @param[in] theLocation transformation to apply 0119 Standard_EXPORT static void AddFreeEdges(TColgp_SequenceOfPnt& theSegments, 0120 const Handle(Poly_Triangulation)& thePolyTri, 0121 const gp_Trsf& theLocation); 0122 }; 0123 0124 #endif // _Prs3d_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|