/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #include "MGCLStdAfx.h" #include "mg/Unit_vector.h" #include "mg/Point.h" #include "mg/Box.h" #include "mg/Matrix.h" #include "mg/Transf.h" #include "mg/Tolerance.h" #if defined(_DEBUG) #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // //Implement MGPoint Class. //MGPoint is an abstract class which represents zero dimensional manifold. // //Constructor //Void constructor(初期化なしでオブジェクトを作成する。) MGPoint::MGPoint(){;} //Construct a point from a position. MGPoint::MGPoint(const MGPosition& P) :m_point(P){;} //Construct a point by changing the space dimension or ordering //the space dimension element. MGPoint::MGPoint( int sdim, //new space dimension. const MGPoint& P //original point. , int start1 //start position coordinate of new point. , int start2) //start position coordinate of the original. :m_point(sdim,P.m_point,start1,start2){;} //Virtual Destructor MGPoint::~MGPoint(){;} //Operator overload(演算子多重定義) //Logical operator overload(論理演算子多重定義) bool MGPoint::operator<(const MGPoint& gel2)const{ return m_point.len()0 if the point is on the geometry, // and 0 if the point is not on the geometry. bool MGPoint::on( const MGPosition& P,//Point(指定点) MGPosition& param //Parameter of the geometry(パラメータ) )const{ param=MGPosition(); return MGAZero((P-m_point).len()); } //Compute parameter value of given point. // 自身の上の指定点を表すパラメータ値を返す。 // If input point is not on the geometry, return the nearest point on the // geometry. MGPosition MGPoint::parameter( const MGPosition& P //Point(指定点) )const{ return MGPosition(); } //Return parameter range of the geometry(パラメータ範囲を返す) MGBox MGPoint::parameter_range()const{ return MGBox(); } //Round t into geometry's parameter range. // 入力パラメータをパラメータ範囲でまるめて返却する。 MGPosition MGPoint::range(const MGPosition& t)const{ return MGPosition(); } //Return space dimension int MGPoint::sdim() const{return m_point.sdim();} //Assignment. //When the leaf object of this and obj2 are not equal, this assignment //does nothing. MGPoint& MGPoint::operator=(const MGPoint& gel2){ if(this==&gel2) return *this; MGGeometry::operator=(gel2); m_point=gel2.m_point; return *this; } MGPoint& MGPoint::operator=(const MGGel& gel2){ const MGPoint* gel2_is_this=dynamic_cast(&gel2); if(gel2_is_this) operator=(*gel2_is_this); return *this; } //Update the geometry by translation. // 与ベクトルだけ曲線を平行移動して自身とする。 MGPoint& MGPoint::operator+=(const MGVector& v){ m_point+=v; return *this; } MGPoint& MGPoint::operator-=(const MGVector& v){ m_point-=v; return *this; } //Update the geometry by multiplying scale. // 与えられたスケールを曲線にかける。 MGPoint& MGPoint::operator*=(double scale){ m_point*=scale; return *this; } //Update the geometry by transformation of matrix. // 与えられた変換で直線の変換を行い自身の直線とする。 MGPoint& MGPoint::operator*=(const MGMatrix& mat){ m_point*=mat; return *this; } //Update the geometry by transformation of transf. // 与えられた変換で曲線のトランスフォームを行い自身とする。 MGPoint& MGPoint::operator*=(const MGTransf& tr){ m_point*=tr; return *this; }