/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGTransf_HH_ #define _MGTransf_HH_ /** @file */ /** @addtogroup BASE * @{ */ #include #include "mg/Default.h" #include "mg/Vector.h" #include "mg/Matrix.h" // Defines class MGTransf // Forward Declarations class MGUnit_vector; class MGPosition; class MGIfstream; class MGOfstream; class MGIgesOfstream; class MGObject; ///MGTransf represents a transformation of a space dimension. ///While MGMatrix is for the transformation about the origin(0,0,0), ///MGTransf is a general transformation. ///Transformation consists of a matrix and a vector. The matrix defines ///an affine transformation and the vector defines a translation. ///Let T be a MGTransf and A be an object. Then MGTransf transformation of the ///object A is defined as: A*T. (Not T*A) class MG_DLL_DECLR MGTransf { public: /// 自身のTransfとscaleの乗算を行いオブジェクトを生成する。 ///Scaling of the transf. MG_DLL_DECLR friend MGTransf operator* (double scale, const MGTransf&); /// ベクトルとトランスフォームの乗算を行いTransfを生成 ///Genarate a Transf by multiplication of a vector and transf. MG_DLL_DECLR friend MGTransf operator* (const MGVector& v, const MGTransf& tr); ///String stream function. MG_DLL_DECLR friend std::ostream& operator<< (std::ostream&, const MGTransf&); //////////// Constructor ////////// /// General Space dimension Constructor. ///When dim>=1, MGMatrix is initialized as a unit matrix. explicit MGTransf(int dim=0); /// 全てのコンポーネントを指定してTransfを生成。 ///Construct Transf from a matrix and a vector. ///***** This is the fundamental constructor.***** MGTransf(const MGMatrix&, const MGVector&); /// 各軸方向で等しい Scaling のTransf生成。 ///Transf from same scaling factor for all coordinates and a translation. MGTransf(double scale, const MGVector&); ///Construct Transf by copying old Transf, changing space dimension, ///and ordering of coordinates. MGTransf (int sdim, const MGTransf& transf, int start1=0, int start2=0); ///////// 2D Constructor.//////////// /// 各軸方向(x,y)で異なる Scaling の2D Transfを生成。 ///2D Transf from different scaling factors for x and y coordinates. ///No translation. MGTransf(double scalex, double scaley); /// Construct 2D space Transf to transform data for 'origin' to be ///origin(0,0,0) and for 'unit' to be x-coordimate. MGTransf(const MGUnit_vector& unit, ///< unit vector to be x-coordinate. const MGPosition& origin ///