mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
AppFwk : Added DisplayCoordTransform
This commit is contained in:
parent
d4bdbcb7c8
commit
de11836e03
@ -15,6 +15,8 @@ include_directories(
|
||||
)
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
cafDisplayCoordTransform.cpp
|
||||
cafDisplayCoordTransform.h
|
||||
cafBoxManipulatorPartManager.cpp
|
||||
cafBoxManipulatorPartManager.h
|
||||
cafBoxManipulatorGeometryGenerator.cpp
|
||||
|
54
Fwk/AppFwk/cafVizExtensions/cafDisplayCoordTransform.cpp
Normal file
54
Fwk/AppFwk/cafVizExtensions/cafDisplayCoordTransform.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cvfMatrix4.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::DisplayCoordTransform::DisplayCoordTransform()
|
||||
: m_scale(1.0, 1.0, 1.0),
|
||||
m_translation(cvf::Vec3d::ZERO)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::DisplayCoordTransform::setScale(const cvf::Vec3d& scale)
|
||||
{
|
||||
m_scale = scale;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::DisplayCoordTransform::setTranslation(const cvf::Vec3d& translation)
|
||||
{
|
||||
m_translation = translation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d caf::DisplayCoordTransform::transformToDisplayCoord(const cvf::Vec3d& domainCoord) const
|
||||
{
|
||||
cvf::Vec3d coord = domainCoord - m_translation;
|
||||
coord.x() *= m_scale.x();
|
||||
coord.y() *= m_scale.y();
|
||||
coord.z() *= m_scale.z();
|
||||
|
||||
return coord;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d caf::DisplayCoordTransform::scaleToDisplaySize(const cvf::Vec3d& domainSize) const
|
||||
{
|
||||
cvf::Vec3d coord = domainSize;
|
||||
coord.x() *= m_scale.x();
|
||||
coord.y() *= m_scale.y();
|
||||
coord.z() *= m_scale.z();
|
||||
|
||||
return coord;
|
||||
}
|
30
Fwk/AppFwk/cafVizExtensions/cafDisplayCoordTransform.h
Normal file
30
Fwk/AppFwk/cafVizExtensions/cafDisplayCoordTransform.h
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class DisplayCoordTransform : public cvf::Object
|
||||
{
|
||||
public:
|
||||
DisplayCoordTransform();
|
||||
|
||||
void setScale(const cvf::Vec3d& scale);
|
||||
void setTranslation(const cvf::Vec3d& translation);
|
||||
|
||||
cvf::Vec3d transformToDisplayCoord(const cvf::Vec3d& domainCoord) const;
|
||||
cvf::Vec3d scaleToDisplaySize(const cvf::Vec3d& domainSize) const;
|
||||
|
||||
private:
|
||||
cvf::Vec3d m_scale;
|
||||
cvf::Vec3d m_translation;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user