/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGStraight_HH_ #define _MGStraight_HH_ #include "mg/EReal.h" #include "mg/Position.h" #include "mg/Unit_vector.h" #include "mg/Curve.h" // MGStraight.h // Definition of MGStraight class class MGBox; class MGInterval; class MGVector; class MGTransf; class MGCCisect; class MGCSisect; class MGRLBRep; class MGEllipse; class MGLBRep; class MGSurfCurve; class MGBSumCurve; class MGCompositeCurve; class MGTrimmedCurve; class MGKnotVector; class MGPlane; class MGSurface; class MGCCisect_list; class MGPosition_list; class MGIfstream; class MGOfstream; /** @file */ /** @addtogroup GEO * @{ */ /// MGStraight is a curve of any space dimension, represent a straight line. /// Parameterization of the MGStraight is as below using parameter t: /// point(t) = m_root_point + t*m_direction. ///MGStraight can be a line segment that has start and end points. ///Let t be the parameter of the straight line(i.e. length from m_root_point), ///then straight lien f(t) can be expressed as: /// f(t)=m_root_point+m_direction*t. class MG_DLL_DECLR MGStraight: public MGCurve{ public: MG_DLL_DECLR friend MGStraight operator+ (const MGVector& v, const MGStraight& sl); MG_DLL_DECLR friend MGStraight operator* (double scale, const MGStraight&); //////////// Conctructor. コンストラクタ //////////// ///Void constructor MGStraight(); ///Copy constructor. MGStraight(const MGStraight& sl); ///Straight specifying all the member data. All of the data are employed as ///member data of this straight. explicit MGStraight ( const MGEReal& endparam, ///t2, the result is ///minus value. double length(double t1, double t2) const; /// 自身の直線が有界の場合、その直線の距離を返却する。 /// 非有界のとき−1を返却する。 ///When type=MGSTRAIGHT_SEGMENT, return the whole length of straight ///line segment. ///Else, return -1. double length() const; /// パラメータtで示される点から指定距離lenはなれた点のパラメータ値を返す。 ///Return the parameter of the line away from point t by length len ///along the straight. double length_param(double t, double len) const; /// 自身の直線に指定されたlimitを付与する。 ///Compute sub straight line limitted by an interval. MGStraight& limit(const MGInterval& ); ///Compute sub straight line limitted by an box. ///This box's coordinates consist of world coordinates. MGStraight& limit(const MGBox& box); ///Compute nearest point on the line to the origin. MGPosition nearest_to_origin() const; /// 直線の方向を反転する(方向ベクトルを逆向きにする。)。 /// 始終点があるときは入れ換える。 ///Negate the direction of the curve. void negate(); ///Obtain parameter value if this curve is negated by "negate()". double negate_param(double t)const; ///一定オフセット関数 ///オフセット方向は、法線方向から見て入力曲線の進行方向左側を正とする。 ///法線ベクトルがヌルの場合、空間次元のエレメント番号が最も大きいエレメントが1の単位ベクトルを正とする。 ///トレランスはline_zero()を使用する。戻り値は、オフセット曲線リストが返却される。 ///costant offset curve. if the norm_vector is given, the positive offset direction decide ///to left hand side from ahead, or the MGUnit_vector() direction. ///line_zero() is used. return value is number of offset curve. MGPvector offset( double ofs_value, ///<オフセット量 const MGVector& norm_vector = mgNULL_VEC///<法線ベクトル )const; /// 点が直線上にあるかを試験する。直線上にあれば,その点のパラメーター値を, /// 直線上になくても最近傍点のパラメーター値を返す。 ///Test if input point is on the line or not. Even if the point is not ///on the line, return nearest point's parameter value. ///Function's return value is true if input point is on the line, /// and false if the point is not on the line. bool on( const MGPosition&, ///=0: number of curves obtained, <0 : Some error detected. int project( const MGFSurface& surf, //given surface. MGPvector& vec_crv_uv, //uv projection curve will be appended. MGPvector& vec_crv, //3d projection curve will be appended. const MGVector& vec //projection vector. //if vec = NULL then calculate perpendicular project. )const; /// 入力パラメータをパラメータ範囲でまるめて返却する。 ///Round the input parameter value t into the parameter range of the line. double range(double) const; //Return two straight line's relationship. //Whe two are parallel, MGPSREL_PARALLEL or MGPSREL_COIN will be returned. //MGPSREL_PARALLEL takes place when no overlapping part exists, and //MGPSREL_COIN when some parts overlaps. //MGPSREL_ISECT when they have an intersection. //MGPSREL_VIRTUAL_ISECT when there is an intersection at extended part of the lines. //MGPSREL_TORSION when the two do not lie on a same plane. MGPSRELATION relation( const MGStraight& sl2,///<2nd straight line. MGCCisect& ip /// oneD( const double g[4] ///