diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPy.xml b/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPy.xml index 167dff70d3..22f810bfa4 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPy.xml +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPy.xml @@ -14,93 +14,171 @@ Delete="false"> - Describes functions to use HLR algorithm. + Algo() -> HLRBRep_Algo + +A framework to compute a shape as seen in a projection +plane. This is done by calculating the visible and the hidden parts +of the shape. HLRBRep_Algo works with three types of entity: + +- shapes to be visualized +- edges in these shapes (these edges are the basic entities which will be + visualized or hidden), and +- faces in these shapes which hide the edges. + +HLRBRep_Algo is based on the principle of comparing each edge of the shape to +be visualized with each of its faces, and calculating the visible and the +hidden parts of each edge. For a given projection, HLRBRep_Algo calculates a +set of lines characteristic of the object being represented. It is also used in +conjunction with the HLRBRep_HLRToShape extraction utilities, which reconstruct +a new, simplified shape from a selection of calculation results. This new shape +is made up of edges, which represent the shape visualized in the +projection. HLRBRep_Algo takes the shape itself into account whereas +HLRBRep_PolyAlgo works with a polyhedral simplification of the shape. When you +use HLRBRep_Algo, you obtain an exact result, whereas, when you use +HLRBRep_PolyAlgo, you reduce computation time but obtain polygonal segments. In +the case of complicated shapes, HLRBRep_Algo may be time-consuming. An +HLRBRep_Algo object provides a framework for: + +- defining the point of view +- identifying the shape or shapes to be visualized +- calculating the outlines +- calculating the visible and hidden lines of the shape. Warning +- Superimposed lines are not eliminated by this algorithm. +- There must be no unfinished objects inside the shape you wish to visualize. +- Points are not treated. +- Note that this is not the sort of algorithm used in generating shading, which + calculates the visible and hidden parts of each face in a shape to be + visualized by comparing each face in the shape with every other face in the + same shape. + - + add(S, nbIso=0) + +Adds the shape S to this framework, and specifies the number of isoparameters +nbiso desired in visualizing S. You may add as many shapes as you wish. Use +the function add once for each shape. - + remove(i) + +Remove the shape of index i from this framework. + - + index(S) -> int + +Return the index of the Shape S and return 0 if the Shape S is not found. + - + outlinedShapeNullify() + +Nullify all the results of OutLiner from HLRTopoBRep. - + setProjector(Origin=(0, 0, 0), ZDir=(0,0,0), XDir=(0,0,0), focus=NaN) + +Set the projector. With focus left to NaN, an axonometric projector is +created. Otherwise, a perspective projector is created with focus focus. - + nbShapes() + +Returns the number of shapes in the collection. It does not modify the +object's state and is used to retrieve the count of shapes. - + showAll(i=-1) + +If i < 1, then set all the edges to visible. +Otherwise, set to visible all the edges of the shape of index i. - + hide(i=-1, j=-1) + +If i < 1, hide all of the datastructure. +Otherwise, if j < 1, hide the shape of index i. +Otherwise, hide the shape of index i by the shape of index j. - + hideAll(i=-1) + +If i < 1, hide all the edges. +Otherwise, hide all the edges of shape of index i. - + partialHide() + +Own hiding of all the shapes of the DataStructure without hiding by each other. - + select(i=-1) + +If i < 1, select all the DataStructure. +Otherwise, only select the shape of index i. - + selectEdge(i) + +Select only the edges of the shape of index i. - + selectFace(i) + +Select only the faces of the shape of index i. - + initEdgeStatus() + +Init the status of the selected edges depending of the back faces of a closed +shell. - + update() + +Update the DataStructure. diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml index b2f219652c..36527f8c7c 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml @@ -14,102 +14,164 @@ Delete="false"> - Describes functions to use HLR algorithm. + PolyAlgo() -> HLRBRep_PolyAlgo + +A framework to compute the shape as seen in a projection +plane. This is done by calculating the visible and the hidden parts of the +shape. HLRBRep_PolyAlgo works with three types of entity: + +- shapes to be visualized (these shapes must have already been triangulated.) +- edges in these shapes (these edges are defined as polygonal lines on the + triangulation of the shape, and are the basic entities which will be visualized + or hidden), and +- triangles in these shapes which hide the edges. + +HLRBRep_PolyAlgo is based on the principle of comparing each edge of the shape +to be visualized with each of the triangles produced by the triangulation of +the shape, and calculating the visible and the hidden parts of each edge. For a +given projection, HLRBRep_PolyAlgo calculates a set of lines characteristic of +the object being represented. It is also used in conjunction with the +HLRBRep_PolyHLRToShape extraction utilities, which reconstruct a new, +simplified shape from a selection of calculation results. This new shape is +made up of edges, which represent the shape visualized in the +projection. HLRBRep_PolyAlgo works with a polyhedral simplification of the +shape whereas HLRBRep_Algo takes the shape itself into account. When you use +HLRBRep_Algo, you obtain an exact result, whereas, when you use +HLRBRep_PolyAlgo, you reduce computation time but obtain polygonal segments. An +HLRBRep_PolyAlgo object provides a framework for: + +- defining the point of view +- identifying the shape or shapes to be visualized +- calculating the outlines +- calculating the visible and hidden lines of the shape. Warning +- Superimposed lines are not eliminated by this algorithm. +- There must be no unfinished objects inside the shape you wish to visualize. +- Points are not treated. +- Note that this is not the sort of algorithm used in generating shading, which + calculates the visible and hidden parts of each face in a shape to be + visualized by comparing each face in the shape with every other face in the + same shape. + + - + load(S) + +Loads the shape S into this framework. Warning S must have already been triangulated. - + remove(i) + +Remove the shape of index i from this framework. + - + nbShapes() + +Returns the number of shapes in the collection. It does not modify the +object's state and is used to retrieve the count of shapes. + - + shape(i) -> TopoShape + +Return the shape of index i. + - + index(S) -> int + +Return the index of the Shape S. + - + setProjector(Origin=(0, 0, 0), ZDir=(0,0,0), XDir=(0,0,0), focus=NaN) + +Set the projector. With focus left to NaN, an axonometric projector is +created. Otherwise, a perspective projector is created with focus focus. - - + update() + +Launches calculation of outlines of the shape visualized by this +framework. Used after setting the point of view and defining the shape or +shapes to be visualized. + - - + + initHide() - - + + moreHide() - - + + nextHide() - - + + initShow() - - + + moreShow() - - + + nextShow() - + outLinedShape(S) -> TopoShape + +Make a shape with the internal outlines in each face of shape S. - + - + - + diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp index 0082278620..a599d7d1ba 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp @@ -86,7 +86,7 @@ PyObject* HLRBRep_PolyAlgoPy::setProjector(PyObject *args, PyObject *kwds) PyObject* xd = nullptr; double focus = std::numeric_limits::quiet_NaN(); - static const std::array kwlist {"Origin", "ZDir", "XDir", nullptr}; + static const std::array kwlist {"Origin", "ZDir", "XDir", "focus", nullptr}; if (Base::Wrapped_ParseTupleAndKeywords(args, kwds, "|O!O!O!d", kwlist, &Base::VectorPy::Type, &ps, &Base::VectorPy::Type, &zd, diff --git a/src/Mod/Part/App/HLRBRep/HLRToShapePy.xml b/src/Mod/Part/App/HLRBRep/HLRToShapePy.xml index 4be1afc6c6..994d0084d0 100644 --- a/src/Mod/Part/App/HLRBRep/HLRToShapePy.xml +++ b/src/Mod/Part/App/HLRBRep/HLRToShapePy.xml @@ -14,75 +14,140 @@ Delete="true"> - Describes functions to use HLR algorithm. + HLRToShape(algo: HLRBRep_Algo) -> HLRBRep_HLRToShape + +A framework for filtering the computation results of an HLRBRep_Algo algorithm +by extraction. From the results calculated by the algorithm on a shape, a +filter returns the type of edge you want to identify. You can choose any of the +following types of output: +- visible sharp edges +- hidden sharp edges +- visible smooth edges +- hidden smooth edges +- visible sewn edges +- hidden sewn edges +- visible outline edges +- hidden outline edges +- visible isoparameters and +- hidden isoparameters. + +Sharp edges present a C0 continuity (non G1). Smooth edges present a G1 +continuity (non G2). Sewn edges present a C2 continuity. The result is composed +of 2D edges in the projection plane of the view which the algorithm has worked +with. These 2D edges are not included in the data structure of the visualized +shape. In order to obtain a complete image, you must combine the shapes given +by each of the chosen filters. The construction of the shape does not call a +new computation of the algorithm, but only reads its internal results. The +methods of this shape are almost identic to those of the HLRBrep_PolyHLRToShape +class. + - + vCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible sharp edges for either shape Shape or +for all added shapes (Shape=None). - + Rg1LineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible smooth edges for either shape Shape or +for all added shapes (Shape=None). + - + RgNLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible sewn edges for either shape Shape or for +all added shapes (Shape=None). + - + outLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible outline edges for either shape Shape or +for all added shapes (Shape=None). - + outLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible outline edges in 3D for either shape +Shape or for all added shapes (Shape=None). - + isoLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible isoparameters for either shape Shape or +for all added shapes (Shape=None). - + hCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden sharp edges for either shape Shape or for +all added shapes (Shape=None). - + Rg1LineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden smooth edges for either shape Shape or +for all added shapes (Shape=None). - + RgNLineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden sewn edges for either shape Shape or for +all added shapes (Shape=None). - + outLineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden outline edges for either shape Shape or +for all added shapes (Shape=None). - + isoLineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden isoparameters for either shape Shape or +for all added shapes (Shape=None). - + compoundOfEdges(Type: int, Visible: bool, In3D: bool, Shape=None) -> TopoShape + +Returns compound of resulting edges of required type and visibility, taking +into account the kind of space (2d or 3d). If Shape=None, return it for all +added shapes, otherwise return it for shape Shape. diff --git a/src/Mod/Part/App/HLRBRep/PolyHLRToShapePy.xml b/src/Mod/Part/App/HLRBRep/PolyHLRToShapePy.xml index b6b61572a4..021f71e5a3 100644 --- a/src/Mod/Part/App/HLRBRep/PolyHLRToShapePy.xml +++ b/src/Mod/Part/App/HLRBRep/PolyHLRToShapePy.xml @@ -14,69 +14,119 @@ Delete="true"> - Describes functions to use HLR algorithm. + PolyHLRToShape(algo: HLRBRep_PolyAlgo) -> HLRBRep_PolyHLRToShape + +A framework for filtering the computation results of an HLRBRep_PolyAlgo +algorithm by extraction. From the results calculated by the algorithm on a +shape, a filter returns the type of edge you want to identify. You can choose +any of the following types of output: +- visible sharp edges +- hidden sharp edges +- visible smooth edges +- hidden smooth edges +- visible sewn edges +- hidden sewn edges +- visible outline edges +- hidden outline edges +- visible isoparameters and +- hidden isoparameters. + +Sharp edges present a C0 continuity (non G1). Smooth edges present a G1 +continuity (non G2). Sewn edges present a C2 continuity. The result is composed +of 2D edges in the projection plane of the view which the algorithm has worked +with. These 2D edges are not included in the data structure of the visualized +shape. In order to obtain a complete image, you must combine the shapes given +by each of the chosen filters. The construction of the shape does not call a +new computation of the algorithm, but only reads its internal results. + - - + + update(algo: HLRBRep_PolyAlgo) - - + + show() - - + + hide() - + vCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible sharp edges for either shape Shape or +for all added shapes (Shape=None). - + Rg1LineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible smooth edges for either shape Shape or +for all added shapes (Shape=None). + - + RgNLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible sewn edges for either shape Shape or for +all added shapes (Shape=None). + - + outLineVCompound(Shape=None) -> TopoShape + +Sets the extraction filter for visible outline edges for either shape Shape or +for all added shapes (Shape=None). - + hCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden sharp edges for either shape Shape or for +all added shapes (Shape=None). - + Rg1LineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden smooth edges for either shape Shape or +for all added shapes (Shape=None). - + RgNLineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden sewn edges for either shape Shape or for +all added shapes (Shape=None). - + outLineHCompound(Shape=None) -> TopoShape + +Sets the extraction filter for hidden outline edges for either shape Shape or +for all added shapes (Shape=None).