You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoTransformation.h

217 lines
7.6 KiB
C++

/**
* @file FITKAbsGeoTransformation.h
* @brief 模型变换抽象类.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
#ifndef FITKABSGEOTRANSFORMATION_H
#define FITKABSGEOTRANSFORMATION_H
#include "FITKAbsGeoCommand.h"
#include "FITKInterfaceGeometryAPI.h"
#include <array>
namespace Interface {
/**
* @brief 变换基类.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoTransformation :
public FITKAbsGeoCommand
{
public:
FITKAbsGeoTransformation() = default;
virtual ~FITKAbsGeoTransformation() = default;
VirtualShape sourceShape() const { return m_SourceShape; }
void setSourceShape(VirtualShape shape) { m_SourceShape = shape; }
bool isCopy() const { return m_IsCopy; }
void setCopy(bool copy) { m_IsCopy = copy; }
protected:
/**
* @brief 原始形状.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
VirtualShape m_SourceShape{};
/**
* @brief 是否拷贝原形状.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
bool m_IsCopy{ false };
};
/**
* @brief 平移变换.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoModelTransform :
public FITKAbsGeoTransformation
{
public:
FITKAbsGeoModelTransform() = default;
~FITKAbsGeoModelTransform() override = default;
FITKGeoEnum::FITKGeometryComType getGeometryCommandType() override;
std::array<double, 3> vector() const { return m_Vector; }
void setVector(std::array<double, 3> vec) { m_Vector = vec; }
void setVector(double x, double y, double z) { m_Vector = { x,y,z }; }
protected:
/**
* @brief 平移向量.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_Vector{};
};
/**
* @brief 通过两个点平移变换.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoModelTransformByTwoPoints :
public FITKAbsGeoModelTransform
{
public:
FITKAbsGeoModelTransformByTwoPoints() = default;
~FITKAbsGeoModelTransformByTwoPoints()override = default;
FITKGeoEnum::FITKGeometryComType getGeometryCommandType() override;
std::array<double, 3> startPoint() const { return m_StartPoint; }
void setStartPoint(std::array<double, 3> vec) { m_StartPoint = vec; }
void setStartPoint(double x, double y, double z) { m_StartPoint = { x,y,z }; }
std::array<double, 3> endPoint() const { return m_EndPoint; }
void setEndPoint(std::array<double, 3> vec) { m_EndPoint = vec; }
void setEndPoint(double x, double y, double z) { m_EndPoint = { x,y,z }; }
protected:
/**
* @brief 起始点.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_StartPoint{};
/**
* @brief 终止点.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_EndPoint{};
};
/**
* @brief 通过方向和距离平移变换.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoModelTransformByDirAndDis :
public FITKAbsGeoModelTransform
{
public:
FITKAbsGeoModelTransformByDirAndDis() = default;
~FITKAbsGeoModelTransformByDirAndDis()override = default;
FITKGeoEnum::FITKGeometryComType getGeometryCommandType() override;
std::array<double, 3> direction() const { return m_Direction; }
void setDirection(std::array<double, 3> dir) { m_Direction = dir; }
void setDirection(double x, double y, double z) { m_Direction = { x,y,z }; }
double distance() const { return m_Distance; }
void setDistance(double dis) { m_Distance = dis; }
protected:
/**
* @brief 平移方向.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_Direction{};
/**
* @brief 平移距离.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
double m_Distance{};
};
/**
* @brief 旋转变换.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoModelRotate :
public FITKAbsGeoTransformation
{
public:
FITKAbsGeoModelRotate() = default;
~FITKAbsGeoModelRotate() override = default;
FITKGeoEnum::FITKGeometryComType getGeometryCommandType() override;
std::array<double, 3> axisStartPoint() const { return m_AxisStartPoint; }
void setAxisStartPoint(std::array<double, 3> xyz) { m_AxisStartPoint = xyz; }
void setAxisStartPoint(double x, double y, double z) { m_AxisStartPoint = { x,y,z }; }
std::array<double, 3> axisEndPoint() const { return m_AxisEndPoint; }
void setAxisEndPoint(std::array<double, 3> xyz) { m_AxisEndPoint = xyz; }
void setAxisEndPoint(double x, double y, double z) { m_AxisEndPoint = { x,y,z }; }
double degree() const { return m_Angle / 3.14159265358979323846 * 180; }
void setDegree(double deg) { m_Angle = deg / 180 * 3.14159265358979323846; }
double radian() const { return m_Angle; }
void setRadian(double rad) { m_Angle = rad; }
protected:
/**
* @brief 旋转轴起始点.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_AxisStartPoint{};
/**
* @brief 旋转轴终止点.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_AxisEndPoint{};
/**
* @brief 旋转角度(弧度值).
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
double m_Angle{};
};
/**
* @brief 缩放变换.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
class FITKInterfaceGeometryAPI FITKAbsGeoModelScale :
public FITKAbsGeoTransformation
{
public:
FITKAbsGeoModelScale() = default;
~FITKAbsGeoModelScale()override = default;
FITKGeoEnum::FITKGeometryComType getGeometryCommandType() override;
std::array<double, 3> factors() const { return m_Factors; }
void setFactors(std::array<double, 3> factors) { m_Factors = factors; }
void setFactors(double x, double y, double z) { m_Factors = { x, y, z }; }
std::array<double, 3> basePoint() const { return m_BasePoint; }
void setBasePoint(std::array<double, 3> point) { m_BasePoint = point; }
void setBasePoint(double x, double y, double z) { m_BasePoint = { x, y, z }; }
protected:
/**
* @brief 缩放因子.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_Factors{};
/**
* @brief 缩放基准点.
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-09-10
*/
std::array<double, 3> m_BasePoint{ 0, 0, 0 };
};
}
#endif // FITKABSGEOTRANSFORMATION_H