mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -24,6 +24,7 @@
|
||||
#include <Graphic3d_TransformPers.hxx>
|
||||
#include <Graphic3d_Vec3.hxx>
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
|
||||
class Graphic3d_GraphicDriver;
|
||||
class Graphic3d_StructureManager;
|
||||
@@ -46,6 +47,12 @@ public:
|
||||
return myGroups;
|
||||
}
|
||||
|
||||
//! Return transformation.
|
||||
const Handle(Geom_Transformation)& Transformation() const { return myTrsf; }
|
||||
|
||||
//! Assign transformation.
|
||||
virtual void SetTransformation (const Handle(Geom_Transformation)& theTrsf) { myTrsf = theTrsf; }
|
||||
|
||||
//! Return transformation persistence.
|
||||
const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
|
||||
|
||||
@@ -105,9 +112,6 @@ public:
|
||||
//! Disconnect other structure to this one
|
||||
virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
|
||||
|
||||
//! Synchronize structure transformation
|
||||
virtual void UpdateTransformation() = 0;
|
||||
|
||||
//! Highlight entire structure with color
|
||||
virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
|
||||
const Standard_Boolean theToCreate) = 0;
|
||||
@@ -134,8 +138,6 @@ public:
|
||||
|
||||
Quantity_Color HighlightColor;
|
||||
|
||||
Graphic3d_Mat4 Transformation;
|
||||
|
||||
int ContainsFacet;
|
||||
|
||||
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
|
||||
@@ -159,6 +161,7 @@ protected:
|
||||
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
|
||||
Graphic3d_SequenceOfGroup myGroups;
|
||||
Graphic3d_BndBox4f myBndBox;
|
||||
Handle(Geom_Transformation) myTrsf;
|
||||
Handle(Graphic3d_TransformPers) myTrsfPers;
|
||||
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
|
||||
|
||||
|
@@ -236,9 +236,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
||||
}
|
||||
else
|
||||
{
|
||||
TColStd_Array2OfReal aTrsf (0, 3, 0, 3);
|
||||
aStruct->Transform (aTrsf);
|
||||
Handle(Graphic3d_Structure) aCompStruct = aStruct->IsTransformed() ? aStruct->Compute (this, aTrsf) : aStruct->Compute (this);
|
||||
Handle(Graphic3d_Structure) aCompStruct = aStruct->IsTransformed() ? aStruct->Compute (this, aStruct->Transformation()) : aStruct->Compute (this);
|
||||
aCompStruct->SetHLRValidation (Standard_True);
|
||||
|
||||
const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME
|
||||
@@ -314,22 +312,11 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
||||
}
|
||||
|
||||
// compute + validation
|
||||
TColStd_Array2OfReal anIdent (0, 3, 0, 3);
|
||||
for (Standard_Integer aRow = 0; aRow <= 3; ++aRow)
|
||||
{
|
||||
for (Standard_Integer aCol = 0; aCol <= 3; ++aCol)
|
||||
{
|
||||
anIdent (aRow, aCol) = (aRow == aCol ? 1.0 : 0.0);
|
||||
}
|
||||
}
|
||||
TColStd_Array2OfReal aTrsf (0, 3, 0, 3);
|
||||
theStruct->Transform (aTrsf);
|
||||
|
||||
Handle(Graphic3d_Structure) aCompStructOld = myStructsComputed.ChangeValue (anIndex);
|
||||
Handle(Graphic3d_Structure) aCompStruct = aCompStructOld;
|
||||
aCompStruct->SetTransform (anIdent, Graphic3d_TOC_REPLACE);
|
||||
theStruct->IsTransformed() ? theStruct->Compute (this, aTrsf, aCompStruct)
|
||||
: theStruct->Compute (this, aCompStruct);
|
||||
aCompStruct->SetTransformation (Handle(Geom_Transformation)());
|
||||
theStruct->IsTransformed() ? theStruct->Compute (this, theStruct->Transformation(), aCompStruct)
|
||||
: theStruct->Compute (this, aCompStruct);
|
||||
aCompStruct->SetHLRValidation (Standard_True);
|
||||
|
||||
// of which type will be the computed?
|
||||
@@ -811,24 +798,13 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
|
||||
// Compute + Validation
|
||||
Handle(Graphic3d_Structure) aStruct;
|
||||
TColStd_Array2OfReal aTrsf (0, 3, 0, 3);
|
||||
theStructure->Transform (aTrsf);
|
||||
if (anIndex != 0)
|
||||
{
|
||||
TColStd_Array2OfReal anIdent (0, 3, 0, 3);
|
||||
for (Standard_Integer ii = 0; ii <= 3; ++ii)
|
||||
{
|
||||
for (Standard_Integer jj = 0; jj <= 3; ++jj)
|
||||
{
|
||||
anIdent (ii, jj) = (ii == jj ? 1.0 : 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
aStruct = myStructsComputed.Value (anIndex);
|
||||
aStruct->SetTransform (anIdent, Graphic3d_TOC_REPLACE);
|
||||
aStruct->SetTransformation (Handle(Geom_Transformation)());
|
||||
if (theStructure->IsTransformed())
|
||||
{
|
||||
theStructure->Compute (this, aTrsf, aStruct);
|
||||
theStructure->Compute (this, theStructure->Transformation(), aStruct);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -838,7 +814,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
else
|
||||
{
|
||||
aStruct = theStructure->IsTransformed()
|
||||
? theStructure->Compute (this, aTrsf)
|
||||
? theStructure->Compute (this, theStructure->Transformation())
|
||||
: theStructure->Compute (this);
|
||||
}
|
||||
|
||||
@@ -952,7 +928,7 @@ void Graphic3d_CView::Highlight (const Handle(Graphic3d_Structure)& theStructure
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const TColStd_Array2OfReal& theTrsf)
|
||||
const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0)
|
||||
@@ -961,9 +937,10 @@ void Graphic3d_CView::SetTransform (const Handle(Graphic3d_Structure)& theStruct
|
||||
// trsf is transferred only if it is :
|
||||
// a translation
|
||||
// a scale
|
||||
if (theTrsf (0, 1) != 0.0 || theTrsf (0, 2) != 0.0
|
||||
|| theTrsf (1, 0) != 0.0 || theTrsf (1, 2) != 0.0
|
||||
|| theTrsf (2, 0) != 0.0 || theTrsf (2, 1) != 0.0)
|
||||
if (!theTrsf.IsNull()
|
||||
&& (theTrsf->Form() == gp_Translation
|
||||
|| theTrsf->Form() == gp_Scale
|
||||
|| theTrsf->Form() == gp_CompoundTrsf))
|
||||
{
|
||||
ReCompute (theStructure);
|
||||
}
|
||||
|
@@ -194,7 +194,7 @@ private:
|
||||
|
||||
//! Transforms the structure in the view.
|
||||
Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const TColStd_Array2OfReal& theTrsf);
|
||||
const Handle(Geom_Transformation)& theTrsf);
|
||||
|
||||
//! Suppress the highlighting on the structure <AStructure>
|
||||
//! in the view <me>.
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include <Graphic3d_Vector.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
|
||||
#include "Graphic3d_Structure.pxx"
|
||||
|
||||
@@ -410,7 +409,8 @@ Standard_Boolean Graphic3d_Structure::IsVisible() const
|
||||
//=============================================================================
|
||||
Standard_Boolean Graphic3d_Structure::IsTransformed() const
|
||||
{
|
||||
return !myCStructure->Transformation.IsIdentity();
|
||||
return !myCStructure->Transformation().IsNull()
|
||||
&& myCStructure->Transformation()->Form() != gp_Identity;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -511,7 +511,7 @@ Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& ,
|
||||
const TColStd_Array2OfReal& )
|
||||
const Handle(Geom_Transformation)& )
|
||||
{
|
||||
// Implemented by Presentation
|
||||
return this;
|
||||
@@ -532,7 +532,7 @@ void Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)&
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& ,
|
||||
const TColStd_Array2OfReal& ,
|
||||
const Handle(Geom_Transformation)& ,
|
||||
Handle(Graphic3d_Structure)& )
|
||||
{
|
||||
// Implemented by Presentation
|
||||
@@ -942,83 +942,20 @@ void Graphic3d_Structure::DisconnectAll (const Graphic3d_TypeOfConnection theTyp
|
||||
//function : SetTransform
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::SetTransform (const TColStd_Array2OfReal& theMatrix,
|
||||
const Graphic3d_TypeOfComposition theType)
|
||||
void Graphic3d_Structure::SetTransformation (const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
if (IsDeleted()) return;
|
||||
|
||||
Standard_Real valuetrsf;
|
||||
Standard_Real valueoldtrsf;
|
||||
Standard_Real valuenewtrsf;
|
||||
TColStd_Array2OfReal aNewTrsf (0, 3, 0, 3);
|
||||
TColStd_Array2OfReal aMatrix44 (0, 3, 0, 3);
|
||||
|
||||
// Assign the new transformation in an array [0..3][0..3]
|
||||
// Avoid problems if the user has defined matrix [1..4][1..4]
|
||||
// or [3..6][-1..2] !!
|
||||
Standard_Integer lr = theMatrix.LowerRow();
|
||||
Standard_Integer ur = theMatrix.UpperRow();
|
||||
Standard_Integer lc = theMatrix.LowerCol();
|
||||
Standard_Integer uc = theMatrix.UpperCol();
|
||||
|
||||
if ((ur - lr + 1 != 4) || (uc - lc + 1 != 4))
|
||||
{
|
||||
Graphic3d_TransformError::Raise ("Transform : not a 4x4 matrix");
|
||||
}
|
||||
|
||||
const Standard_Boolean wasTransformed = IsTransformed();
|
||||
switch (theType)
|
||||
|
||||
if (!theTrsf.IsNull()
|
||||
&& theTrsf->Trsf().Form() == gp_Identity)
|
||||
{
|
||||
case Graphic3d_TOC_REPLACE:
|
||||
{
|
||||
// Update of CStructure
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
myCStructure->Transformation.ChangeValue (i, j) = float (theMatrix (lr + i, lc + j));
|
||||
aNewTrsf (i, j) = theMatrix (lr + i, lc + j);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOC_POSTCONCATENATE:
|
||||
{
|
||||
// To simplify management of indices
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
aMatrix44 (i, j) = theMatrix (lr + i, lc + j);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculation of the product of matrices
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
aNewTrsf (i, j) = 0.0;
|
||||
for (Standard_Integer k = 0; k <= 3; ++k)
|
||||
{
|
||||
valueoldtrsf = myCStructure->Transformation.GetValue (i, k);
|
||||
valuetrsf = aMatrix44 (k, j);
|
||||
valuenewtrsf = aNewTrsf (i, j) + valueoldtrsf * valuetrsf;
|
||||
aNewTrsf (i, j) = valuenewtrsf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update of CStructure
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
myCStructure->Transformation.ChangeValue (i, j) = float (aNewTrsf (i, j));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
myCStructure->SetTransformation (Handle(Geom_Transformation)());
|
||||
}
|
||||
else
|
||||
{
|
||||
myCStructure->SetTransformation (theTrsf);
|
||||
}
|
||||
|
||||
// If transformation, no validation of hidden already calculated parts
|
||||
@@ -1027,37 +964,11 @@ void Graphic3d_Structure::SetTransform (const TColStd_Array2OfReal& theMat
|
||||
ReCompute();
|
||||
}
|
||||
|
||||
myCStructure->UpdateTransformation();
|
||||
myStructureManager->SetTransform (this, aNewTrsf);
|
||||
myStructureManager->SetTransform (this, theTrsf);
|
||||
|
||||
Update (true);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Transform
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::Transform (TColStd_Array2OfReal& theMatrix) const
|
||||
{
|
||||
|
||||
Standard_Integer lr = theMatrix.LowerRow ();
|
||||
Standard_Integer ur = theMatrix.UpperRow ();
|
||||
Standard_Integer lc = theMatrix.LowerCol ();
|
||||
Standard_Integer uc = theMatrix.UpperCol ();
|
||||
|
||||
if ((ur - lr + 1 != 4) || (uc - lc + 1 != 4))
|
||||
Graphic3d_TransformError::Raise ("Transform : not a 4x4 matrix");
|
||||
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
theMatrix (lr + i, lc + j) = myCStructure->Transformation.GetValue (i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//function : MinMaxValues
|
||||
//purpose :
|
||||
@@ -1235,10 +1146,12 @@ void Graphic3d_Structure::addTransformed (Graphic3d_BndBox4d& theBox,
|
||||
aBox = aCombinedBox;
|
||||
if (aBox.IsValid())
|
||||
{
|
||||
TColStd_Array2OfReal aTrsf (0, 3, 0, 3);
|
||||
Transform (aTrsf);
|
||||
TransformBoundaries (aTrsf, aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
|
||||
aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
|
||||
if (!myCStructure->Transformation().IsNull())
|
||||
{
|
||||
TransformBoundaries (myCStructure->Transformation()->Trsf(),
|
||||
aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
|
||||
aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
|
||||
}
|
||||
|
||||
// if box is still valid after transformation
|
||||
if (aBox.IsValid())
|
||||
@@ -1256,73 +1169,29 @@ void Graphic3d_Structure::addTransformed (Graphic3d_BndBox4d& theBox,
|
||||
//function : Transforms
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::Transforms (const TColStd_Array2OfReal& theTrsf,
|
||||
void Graphic3d_Structure::Transforms (const gp_Trsf& theTrsf,
|
||||
const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
|
||||
Standard_Real& theNewX, Standard_Real& theNewY, Standard_Real& theNewZ)
|
||||
{
|
||||
const Standard_Real aRL = RealLast();
|
||||
const Standard_Real aRF = RealFirst();
|
||||
theNewX = theX;
|
||||
theNewY = theY;
|
||||
theNewZ = theZ;
|
||||
if ((theX == aRF) || (theY == aRF) || (theZ == aRF)
|
||||
|| (theX == aRL) || (theY == aRL) || (theZ == aRL))
|
||||
{
|
||||
theNewX = theX;
|
||||
theNewY = theY;
|
||||
theNewZ = theZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real A, B, C, D;
|
||||
A = theTrsf (0, 0);
|
||||
B = theTrsf (0, 1);
|
||||
C = theTrsf (0, 2);
|
||||
D = theTrsf (0, 3);
|
||||
theNewX = A * theX + B * theY + C * theZ + D;
|
||||
A = theTrsf (1, 0);
|
||||
B = theTrsf (1, 1);
|
||||
C = theTrsf (1, 2);
|
||||
D = theTrsf (1, 3);
|
||||
theNewY = A * theX + B * theY + C * theZ + D;
|
||||
A = theTrsf (2, 0);
|
||||
B = theTrsf (2, 1);
|
||||
C = theTrsf (2, 2);
|
||||
D = theTrsf (2, 3);
|
||||
theNewZ = A * theX + B * theY + C * theZ + D;
|
||||
return;
|
||||
}
|
||||
|
||||
theTrsf.Transforms (theNewX, theNewY, theNewZ);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Transforms
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Graphic3d_Vector Graphic3d_Structure::Transforms (const TColStd_Array2OfReal& theTrsf,
|
||||
const Graphic3d_Vector& theCoord)
|
||||
{
|
||||
Standard_Real anXYZ[3];
|
||||
Graphic3d_Structure::Transforms (theTrsf,
|
||||
theCoord.X(), theCoord.Y(), theCoord.Z(),
|
||||
anXYZ[0], anXYZ[1], anXYZ[2]);
|
||||
return Graphic3d_Vector (anXYZ[0], anXYZ[1], anXYZ[2]);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Transforms
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
Graphic3d_Vertex Graphic3d_Structure::Transforms (const TColStd_Array2OfReal& theTrsf,
|
||||
const Graphic3d_Vertex& theCoord)
|
||||
{
|
||||
Standard_Real anXYZ[3];
|
||||
Graphic3d_Structure::Transforms (theTrsf,
|
||||
theCoord.X(), theCoord.Y(), theCoord.Z(),
|
||||
anXYZ[0], anXYZ[1], anXYZ[2]);
|
||||
return Graphic3d_Vertex (anXYZ[0], anXYZ[1], anXYZ[2]);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Transforms
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::TransformBoundaries (const TColStd_Array2OfReal& theTrsf,
|
||||
void Graphic3d_Structure::TransformBoundaries (const gp_Trsf& theTrsf,
|
||||
Standard_Real& theXMin,
|
||||
Standard_Real& theYMin,
|
||||
Standard_Real& theZMin,
|
||||
@@ -1461,16 +1330,9 @@ void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod t
|
||||
//function : GraphicTransform
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void Graphic3d_Structure::GraphicTransform (const TColStd_Array2OfReal& theMatrix)
|
||||
void Graphic3d_Structure::GraphicTransform (const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
for (Standard_Integer i = 0; i <= 3; ++i)
|
||||
{
|
||||
for (Standard_Integer j = 0; j <= 3; ++j)
|
||||
{
|
||||
myCStructure->Transformation.ChangeValue (i, j) = float (theMatrix (i, j));
|
||||
}
|
||||
}
|
||||
myCStructure->UpdateTransformation();
|
||||
myCStructure->SetTransformation (theTrsf);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||
#include <Graphic3d_TypeOfConnection.hxx>
|
||||
#include <Graphic3d_MapOfStructure.hxx>
|
||||
@@ -200,14 +199,17 @@ public:
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector);
|
||||
|
||||
//! 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_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf);
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure);
|
||||
|
||||
//! 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_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Forces a new construction of the structure <me>
|
||||
//! if <me> is displayed and TOS_COMPUTED.
|
||||
Standard_EXPORT void ReCompute();
|
||||
@@ -330,53 +332,14 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Boolean HLRValidation() const;
|
||||
|
||||
//! Modifies the current local modelling transformation
|
||||
//! in the structure <me>.
|
||||
//!
|
||||
//! It is defined as a 4*4 real matrix.
|
||||
//!
|
||||
//! -------------------
|
||||
//! | a11 a12 a13 t1 |
|
||||
//! | a21 a22 a23 t2 |
|
||||
//! | a31 a32 a33 t3 |
|
||||
//! | 0 0 0 1 |
|
||||
//! -------------------
|
||||
//!
|
||||
//! TypeOfComposition : TOC_REPLACE
|
||||
//! TOC_POSTCONCATENATE
|
||||
//!
|
||||
//! Then the modified Local Modelling Transformation is composed
|
||||
//! with the current Global Modelling Transformation to create a
|
||||
//! new Composite Modelling Transformation.
|
||||
//!
|
||||
//! The compose type specifies the role of the current local
|
||||
//! modelling transformation (L) in composing the new value for
|
||||
//! the current local modelling transformation (L'), which is
|
||||
//! then combined with the current global modelling transforma-
|
||||
//! tion (G) to calculate the new composite modelling transfor-
|
||||
//! mation (C).
|
||||
//!
|
||||
//! TOC_REPLACE
|
||||
//! The transformation matrix (T) replaces the value of
|
||||
//! current local modelling transformation (L).
|
||||
//!
|
||||
//! L' <- T
|
||||
//! C <- G x L'
|
||||
//!
|
||||
//! TOC_POSTCONCATENATE
|
||||
//! The current local modelling transformation (L) is multiplied
|
||||
//! by the transformation matrix (T):
|
||||
//!
|
||||
//! L' <- T x L
|
||||
//! C <- G x L'
|
||||
//!
|
||||
//! Category: Methods to manage the structure transformation
|
||||
//! Warning: Raises TransformError if the matrix is not a 4x4 matrix.
|
||||
Standard_EXPORT void SetTransform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
|
||||
|
||||
//! Returns the transformation associated with
|
||||
//! the structure <me>.
|
||||
Standard_EXPORT void Transform (TColStd_Array2OfReal& AMatrix) const;
|
||||
//! Return local transformation.
|
||||
const Handle(Geom_Transformation)& Transformation() const { return myCStructure->Transformation(); }
|
||||
|
||||
//! Modifies the current local transformation
|
||||
Standard_EXPORT void SetTransformation (const Handle(Geom_Transformation)& theTrsf);
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - SetTransformation() should be called instead")
|
||||
void Transform (const Handle(Geom_Transformation)& theTrsf) { SetTransformation (theTrsf); }
|
||||
|
||||
//! Modifies the current transform persistence (pan, zoom or rotate)
|
||||
Standard_EXPORT void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
|
||||
@@ -403,7 +366,8 @@ public:
|
||||
//! Highlights the structure <me>.
|
||||
Standard_EXPORT void GraphicHighlight (const Aspect_TypeOfHighlightMethod Method);
|
||||
|
||||
Standard_EXPORT void GraphicTransform (const TColStd_Array2OfReal& AMatrix);
|
||||
//! Internal method which sets new transformation without calling graphic manager callbacks.
|
||||
Standard_EXPORT void GraphicTransform (const Handle(Geom_Transformation)& theTrsf);
|
||||
|
||||
//! Suppress the highlight for the structure <me>.
|
||||
Standard_EXPORT void GraphicUnHighlight();
|
||||
@@ -421,15 +385,11 @@ public:
|
||||
|
||||
Standard_EXPORT void SetComputeVisual (const Graphic3d_TypeOfStructure AVisual);
|
||||
|
||||
//! Transforms <X>, <Y>, <Z> with the transformation <ATrsf>.
|
||||
Standard_EXPORT static void Transforms (const TColStd_Array2OfReal& ATrsf, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& NewX, Standard_Real& NewY, Standard_Real& NewZ);
|
||||
|
||||
//! Transforms <Coord> with the transformation <ATrsf>.
|
||||
Standard_EXPORT static Graphic3d_Vector Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vector& Coord);
|
||||
|
||||
//! Transforms <Coord> with the transformation <ATrsf>.
|
||||
Standard_EXPORT static Graphic3d_Vertex Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vertex& Coord);
|
||||
|
||||
//! Transforms theX, theY, theZ with the transformation theTrsf.
|
||||
Standard_EXPORT static void Transforms (const gp_Trsf& theTrsf,
|
||||
const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
|
||||
Standard_Real& theNewX, Standard_Real& theNewY, Standard_Real& theNewZ);
|
||||
|
||||
//! Returns the low-level structure
|
||||
const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; }
|
||||
|
||||
@@ -441,8 +401,10 @@ friend class Graphic3d_Group;
|
||||
protected:
|
||||
|
||||
//! Transforms boundaries with <theTrsf> transformation.
|
||||
Standard_EXPORT static void TransformBoundaries (const TColStd_Array2OfReal& theTrsf, Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin, Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax);
|
||||
|
||||
Standard_EXPORT static void TransformBoundaries (const gp_Trsf& theTrsf,
|
||||
Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
|
||||
Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax);
|
||||
|
||||
//! Appends new descendant structure.
|
||||
Standard_EXPORT Standard_Boolean AppendDescendant (const Standard_Address theDescendant);
|
||||
|
||||
|
@@ -399,7 +399,7 @@ void Graphic3d_StructureManager::UnHighlight()
|
||||
// purpose :
|
||||
// ========================================================================
|
||||
void Graphic3d_StructureManager::SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const TColStd_Array2OfReal& theTrsf)
|
||||
const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
|
||||
{
|
||||
|
@@ -133,7 +133,7 @@ public:
|
||||
Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& theStructure, const Aspect_TypeOfHighlightMethod theMethod);
|
||||
|
||||
//! Transforms the structure.
|
||||
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const TColStd_Array2OfReal& theTrsf);
|
||||
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const Handle(Geom_Transformation)& theTrsf);
|
||||
|
||||
//! Changes the display priority of the structure <AStructure>.
|
||||
Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer theOldPriority, const Standard_Integer theNewPriority);
|
||||
|
Reference in New Issue
Block a user