mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-01 10:26:12 +03:00
0031922: Configuration - unresolved external symbol NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate()
A normal method Graphic3d_Camera::Interpolate() is now exported instead of template method NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate().
This commit is contained in:
parent
ad2ef2599a
commit
026aec1860
@ -1576,18 +1576,19 @@ bool Graphic3d_Camera::ZFitAll (const Standard_Real theScaleFactor,
|
|||||||
//function : Interpolate
|
//function : Interpolate
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
template<>
|
void Graphic3d_Camera::Interpolate (const Handle(Graphic3d_Camera)& theStart,
|
||||||
Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (const double theT,
|
const Handle(Graphic3d_Camera)& theEnd,
|
||||||
Handle(Graphic3d_Camera)& theCamera) const
|
const double theT,
|
||||||
|
Handle(Graphic3d_Camera)& theCamera)
|
||||||
{
|
{
|
||||||
if (Abs (theT - 1.0) < Precision::Confusion())
|
if (Abs (theT - 1.0) < Precision::Confusion())
|
||||||
{
|
{
|
||||||
// just copy end-point transformation
|
// just copy end-point transformation
|
||||||
theCamera->Copy (myEnd);
|
theCamera->Copy (theEnd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theCamera->Copy (myStart);
|
theCamera->Copy (theStart);
|
||||||
if (Abs (theT - 0.0) < Precision::Confusion())
|
if (Abs (theT - 0.0) < Precision::Confusion())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1595,8 +1596,8 @@ Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (co
|
|||||||
|
|
||||||
// apply rotation
|
// apply rotation
|
||||||
{
|
{
|
||||||
gp_Ax3 aCamStart = cameraToAx3 (*myStart);
|
gp_Ax3 aCamStart = cameraToAx3 (*theStart);
|
||||||
gp_Ax3 aCamEnd = cameraToAx3 (*myEnd);
|
gp_Ax3 aCamEnd = cameraToAx3 (*theEnd);
|
||||||
gp_Trsf aTrsfStart, aTrsfEnd;
|
gp_Trsf aTrsfStart, aTrsfEnd;
|
||||||
aTrsfStart.SetTransformation (aCamStart, gp::XOY());
|
aTrsfStart.SetTransformation (aCamStart, gp::XOY());
|
||||||
aTrsfEnd .SetTransformation (aCamEnd, gp::XOY());
|
aTrsfEnd .SetTransformation (aCamEnd, gp::XOY());
|
||||||
@ -1612,13 +1613,13 @@ Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (co
|
|||||||
|
|
||||||
// apply translation
|
// apply translation
|
||||||
{
|
{
|
||||||
gp_XYZ aCenter = NCollection_Lerp<gp_XYZ>::Interpolate (myStart->Center().XYZ(), myEnd->Center().XYZ(), theT);
|
gp_XYZ aCenter = NCollection_Lerp<gp_XYZ>::Interpolate (theStart->Center().XYZ(), theEnd->Center().XYZ(), theT);
|
||||||
gp_XYZ anEye = NCollection_Lerp<gp_XYZ>::Interpolate (myStart->Eye().XYZ(), myEnd->Eye().XYZ(), theT);
|
gp_XYZ anEye = NCollection_Lerp<gp_XYZ>::Interpolate (theStart->Eye().XYZ(), theEnd->Eye().XYZ(), theT);
|
||||||
gp_XYZ anAnchor = aCenter;
|
gp_XYZ anAnchor = aCenter;
|
||||||
Standard_Real aKc = 0.0;
|
Standard_Real aKc = 0.0;
|
||||||
|
|
||||||
const Standard_Real aDeltaCenter = myStart->Center().Distance (myEnd->Center());
|
const Standard_Real aDeltaCenter = theStart->Center().Distance (theEnd->Center());
|
||||||
const Standard_Real aDeltaEye = myStart->Eye() .Distance (myEnd->Eye());
|
const Standard_Real aDeltaEye = theStart->Eye() .Distance (theEnd->Eye());
|
||||||
if (aDeltaEye <= gp::Resolution())
|
if (aDeltaEye <= gp::Resolution())
|
||||||
{
|
{
|
||||||
anAnchor = anEye;
|
anAnchor = anEye;
|
||||||
@ -1628,14 +1629,14 @@ Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (co
|
|||||||
{
|
{
|
||||||
aKc = aDeltaCenter / (aDeltaCenter + aDeltaEye);
|
aKc = aDeltaCenter / (aDeltaCenter + aDeltaEye);
|
||||||
|
|
||||||
const gp_XYZ anAnchorStart = NCollection_Lerp<gp_XYZ>::Interpolate (myStart->Center().XYZ(), myStart->Eye().XYZ(), aKc);
|
const gp_XYZ anAnchorStart = NCollection_Lerp<gp_XYZ>::Interpolate (theStart->Center().XYZ(), theStart->Eye().XYZ(), aKc);
|
||||||
const gp_XYZ anAnchorEnd = NCollection_Lerp<gp_XYZ>::Interpolate (myEnd ->Center().XYZ(), myEnd ->Eye().XYZ(), aKc);
|
const gp_XYZ anAnchorEnd = NCollection_Lerp<gp_XYZ>::Interpolate (theEnd ->Center().XYZ(), theEnd ->Eye().XYZ(), aKc);
|
||||||
anAnchor = NCollection_Lerp<gp_XYZ>::Interpolate (anAnchorStart, anAnchorEnd, theT);
|
anAnchor = NCollection_Lerp<gp_XYZ>::Interpolate (anAnchorStart, anAnchorEnd, theT);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gp_Vec aDirEyeToCenter = theCamera->Direction();
|
const gp_Vec aDirEyeToCenter = theCamera->Direction();
|
||||||
const Standard_Real aDistEyeCenterStart = myStart->Eye().Distance (myStart->Center());
|
const Standard_Real aDistEyeCenterStart = theStart->Eye().Distance (theStart->Center());
|
||||||
const Standard_Real aDistEyeCenterEnd = myEnd ->Eye().Distance (myEnd ->Center());
|
const Standard_Real aDistEyeCenterEnd = theEnd ->Eye().Distance (theEnd ->Center());
|
||||||
const Standard_Real aDistEyeCenter = NCollection_Lerp<Standard_Real>::Interpolate (aDistEyeCenterStart, aDistEyeCenterEnd, theT);
|
const Standard_Real aDistEyeCenter = NCollection_Lerp<Standard_Real>::Interpolate (aDistEyeCenterStart, aDistEyeCenterEnd, theT);
|
||||||
aCenter = anAnchor + aDirEyeToCenter.XYZ() * aDistEyeCenter * aKc;
|
aCenter = anAnchor + aDirEyeToCenter.XYZ() * aDistEyeCenter * aKc;
|
||||||
anEye = anAnchor - aDirEyeToCenter.XYZ() * aDistEyeCenter * (1.0 - aKc);
|
anEye = anAnchor - aDirEyeToCenter.XYZ() * aDistEyeCenter * (1.0 - aKc);
|
||||||
@ -1644,10 +1645,10 @@ Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply scaling
|
// apply scaling
|
||||||
if (Abs(myStart->Scale() - myEnd->Scale()) > Precision::Confusion()
|
if (Abs(theStart->Scale() - theEnd->Scale()) > Precision::Confusion()
|
||||||
&& myStart->IsOrthographic())
|
&& theStart->IsOrthographic())
|
||||||
{
|
{
|
||||||
const Standard_Real aScale = NCollection_Lerp<Standard_Real>::Interpolate (myStart->Scale(), myEnd->Scale(), theT);
|
const Standard_Real aScale = NCollection_Lerp<Standard_Real>::Interpolate (theStart->Scale(), theEnd->Scale(), theT);
|
||||||
theCamera->SetScale (aScale);
|
theCamera->SetScale (aScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,35 @@ public:
|
|||||||
IODType_Relative
|
IODType_Relative
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Linear interpolation tool for camera orientation and position.
|
||||||
|
//! This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
|
||||||
|
//! @sa Graphic3d_CameraLerp
|
||||||
|
//!
|
||||||
|
//! Eye/Center interpolation is performed through defining an anchor point in-between Center and Eye.
|
||||||
|
//! The anchor position is defined as point near to the camera point which has smaller translation part.
|
||||||
|
//! The main idea is to keep the distance between Center and Eye
|
||||||
|
//! (which will change if Center and Eye translation will be interpolated independently).
|
||||||
|
//! E.g.:
|
||||||
|
//! - When both Center and Eye are moved at the same vector -> both will be just translated by straight line;
|
||||||
|
//! - When Center is not moved -> camera Eye will move around Center through arc;
|
||||||
|
//! - When Eye is not moved -> camera Center will move around Eye through arc;
|
||||||
|
//! - When both Center and Eye are move by different vectors -> transformation will be something in between,
|
||||||
|
//! and will try interpolate linearly the distance between Center and Eye.
|
||||||
|
//!
|
||||||
|
//! This transformation might be not in line with user expectations.
|
||||||
|
//! In this case, application might define intermediate camera positions for interpolation or implement own interpolation logic.
|
||||||
|
//!
|
||||||
|
//! @param theStart [in] initial camera position
|
||||||
|
//! @param theEnd [in] final camera position
|
||||||
|
//! @param theT [in] step between initial and final positions within [0,1] range
|
||||||
|
//! @param theCamera [out] interpolation result
|
||||||
|
Standard_EXPORT static void Interpolate (const Handle(Graphic3d_Camera)& theStart,
|
||||||
|
const Handle(Graphic3d_Camera)& theEnd,
|
||||||
|
const double theT,
|
||||||
|
Handle(Graphic3d_Camera)& theCamera);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
@ -836,24 +865,17 @@ DEFINE_STANDARD_HANDLE (Graphic3d_Camera, Standard_Transient)
|
|||||||
|
|
||||||
//! Linear interpolation tool for camera orientation and position.
|
//! Linear interpolation tool for camera orientation and position.
|
||||||
//! This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
|
//! This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
|
||||||
//!
|
//! @sa Graphic3d_Camera::Interpolate()
|
||||||
//! Eye/Center interpolation is performed through defining an anchor point in-between Center and Eye.
|
|
||||||
//! The anchor position is defined as point near to the camera point which has smaller translation part.
|
|
||||||
//! The main idea is to keep the distance between Center and Eye
|
|
||||||
//! (which will change if Center and Eye translation will be interpolated independently).
|
|
||||||
//! E.g.:
|
|
||||||
//! - When both Center and Eye are moved at the same vector -> both will be just translated by straight line
|
|
||||||
//! - When Center is not moved -> camera Eye will move around Center through arc
|
|
||||||
//! - When Eye is not moved -> camera Center will move around Eye through arc
|
|
||||||
//! - When both Center and Eye are move by different vectors -> transformation will be something in between,
|
|
||||||
//! and will try interpolate linearly the distance between Center and Eye.
|
|
||||||
//!
|
|
||||||
//! This transformation might be not in line with user expectations.
|
|
||||||
//! In this case, application might define intermediate camera positions for interpolation
|
|
||||||
//! or implement own interpolation logic.
|
|
||||||
template<>
|
template<>
|
||||||
Standard_EXPORT void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (const double theT,
|
inline void NCollection_Lerp<Handle(Graphic3d_Camera)>::Interpolate (const double theT,
|
||||||
Handle(Graphic3d_Camera)& theResult) const;
|
Handle(Graphic3d_Camera)& theResult) const
|
||||||
|
{
|
||||||
|
Graphic3d_Camera::Interpolate (myStart, myEnd, theT, theResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Linear interpolation tool for camera orientation and position.
|
||||||
|
//! This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
|
||||||
|
//! @sa Graphic3d_Camera::Interpolate()
|
||||||
typedef NCollection_Lerp<Handle(Graphic3d_Camera)> Graphic3d_CameraLerp;
|
typedef NCollection_Lerp<Handle(Graphic3d_Camera)> Graphic3d_CameraLerp;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user