mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0025180: Visualization - Homogeneous transformation API in TKV3d
PrsMgr_PresentableObject, Graphic3d_Structure now consistently take and store Handle(Geom_Transformation) instead of TColStd_Array2OfReal / Graphic3d_Mat4. Low-level advanced methods have been modified to pass Handle(Geom_Transformation). High-level methods have been preserved accepting old syntax taking gp_Trsf. Geom_Transformation now inlines most methods.
This commit is contained in:
@@ -28,25 +28,9 @@
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure)
|
||||
|
||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||
static void MakeGraphicTrsf (const Handle(Geom_Transformation)& aGeomTrsf,
|
||||
TColStd_Array2OfReal& Array){
|
||||
for (Standard_Integer i=1; i<=3; i++){
|
||||
for (Standard_Integer j=1; j<=4; j++){
|
||||
Array.SetValue(i,j,aGeomTrsf->Value(i,j));
|
||||
}
|
||||
}
|
||||
Array.SetValue(4,1,0.);
|
||||
Array.SetValue(4,2,0.);
|
||||
Array.SetValue(4,3,0.);
|
||||
Array.SetValue(4,4,1.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prs3d_Presentation
|
||||
//purpose :
|
||||
@@ -72,78 +56,6 @@ Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_Presentation::Transform(const Handle(Geom_Transformation)& aTransformation)
|
||||
{
|
||||
TColStd_Array2OfReal Array (1,4,1,4);
|
||||
MakeGraphicTrsf(aTransformation, Array);
|
||||
SetTransform(Array, Graphic3d_TOC_REPLACE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Transformation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Transformation) Prs3d_Presentation::Transformation() const {
|
||||
TColStd_Array2OfReal matrix(1,4,1,4);
|
||||
|
||||
Graphic3d_Structure::Transform(matrix);
|
||||
|
||||
gp_Trsf trsf;
|
||||
trsf.SetValues(
|
||||
matrix.Value(1,1),matrix.Value(1,2),matrix.Value(1,3),matrix.Value(1,4),
|
||||
matrix.Value(2,1),matrix.Value(2,2),matrix.Value(2,3),matrix.Value(2,4),
|
||||
matrix.Value(3,1),matrix.Value(3,2),matrix.Value(3,3),matrix.Value(3,4));
|
||||
Handle(Geom_Transformation) gtrsf = new Geom_Transformation(trsf);
|
||||
|
||||
return gtrsf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Place
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Place (const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
const Quantity_Length Z)
|
||||
{
|
||||
Handle(Geom_Transformation) aTransformation = new Geom_Transformation;
|
||||
aTransformation->SetTranslation(gp_Vec(X,Y,Z));
|
||||
TColStd_Array2OfReal Array (1,4,1,4);
|
||||
MakeGraphicTrsf(aTransformation, Array);
|
||||
SetTransform(Array, Graphic3d_TOC_REPLACE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Multiply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Multiply(const Handle(Geom_Transformation)& aTransformation)
|
||||
{
|
||||
TColStd_Array2OfReal Array (1,4,1,4);
|
||||
MakeGraphicTrsf(aTransformation, Array);
|
||||
SetTransform(Array, Graphic3d_TOC_POSTCONCATENATE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Move
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Move (const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
const Quantity_Length Z)
|
||||
{
|
||||
Handle(Geom_Transformation) aTransformation = new Geom_Transformation;
|
||||
aTransformation->SetTranslation(gp_Vec(X,Y,Z));
|
||||
TColStd_Array2OfReal Array (1,4,1,4);
|
||||
MakeGraphicTrsf(aTransformation, Array);
|
||||
SetTransform(Array, Graphic3d_TOC_POSTCONCATENATE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
@@ -212,23 +124,23 @@ void Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& a
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& aDataStruc,
|
||||
const TColStd_Array2OfReal& anArray)
|
||||
Handle(Graphic3d_Structure) Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
|
||||
const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
return Graphic3d_Structure::Compute(aDataStruc,anArray);
|
||||
return Graphic3d_Structure::Compute (theDataStruc, theTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& aDataStruc,
|
||||
const TColStd_Array2OfReal& anArray,
|
||||
Handle(Graphic3d_Structure)& aStruc)
|
||||
void Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
Handle(Graphic3d_Structure)& theStruc)
|
||||
{
|
||||
Graphic3d_Structure::Compute(aDataStruc,anArray,aStruc);
|
||||
Graphic3d_Structure::Compute (theDataStruc, theTrsf, theStruc);
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
class Prs3d_Root;
|
||||
class Graphic3d_StructureManager;
|
||||
@@ -49,7 +48,6 @@ class Prs3d_Presentation : public Graphic3d_Structure
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a presentation object
|
||||
//! if <Init> is false, no color initialization is done.
|
||||
Standard_EXPORT Prs3d_Presentation(const Handle(Graphic3d_StructureManager)& theStructManager, const Standard_Boolean theToInit = Standard_True);
|
||||
@@ -60,54 +58,31 @@ public:
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix, Handle(Graphic3d_Structure)& aStructure) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
Handle(Graphic3d_Structure)& theStructure) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Transform (const Handle(Geom_Transformation)& aTransformation);
|
||||
|
||||
Standard_EXPORT void Place (const Quantity_Length X, const Quantity_Length Y, const Quantity_Length Z);
|
||||
|
||||
Standard_EXPORT void Multiply (const Handle(Geom_Transformation)& aTransformation);
|
||||
|
||||
Standard_EXPORT void Move (const Quantity_Length X, const Quantity_Length Y, const Quantity_Length Z);
|
||||
|
||||
Standard_EXPORT Handle(Geom_Transformation) Transformation() const;
|
||||
|
||||
Standard_EXPORT void Connect (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
Standard_EXPORT void Remove (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
Standard_EXPORT void RemoveAll();
|
||||
|
||||
|
||||
friend class Prs3d_Root;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT Handle(Graphic3d_Group) CurrentGroup() const;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Prs3d_Presentation_HeaderFile
|
||||
|
Reference in New Issue
Block a user