/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGSphere_HH_ #define _MGSphere_HH_ #include "mg/Position.h" #include "mg/Unit_vector.h" #include "mg/CSisect_list.h" #include "mg/Surface.h" #include "mg/Ellipse.h" #include "mg/Straight.h" // MGSphere.h // Header for class MGSphere class MGTransf; class MGStraight; class MGSBRep; class MGIfstream; class MGOfstream; class MGIgesOfstream; /** @file */ /** @addtogroup GEO * @{ */ ///MGSphere is a Sphere in 3D space. ///Sphere f(u,v) is expressed /// by two ellipses EL1(m_ellipseu) and EL2(m_ellipsev) as: ///f(u,v) = C+(M*cos(u)+N*sin(u))*cos(v)+B*sin(v), or ///f(u,v) = C+EL1(u)*cos(v)+B*sin(v), ///where EL1=M*cos(u)+N*sin(u), and EL2=C+N*cos(v)+B*sin(v). ///Here M is the major axis of EL1, N is the minor axis of EL1, N is ///also the major axis of EL2, and B=(unit vector of (M*N))*(N.len()), ///which is the minor axis of EL2. (M,N,B) make a orthonormal system. ///v is the angle with M axis in the (B,M) plane, and u is the angle with M in the (M,N) plane. ///v=0 parameter line makes the ellipse C+EL1, and u=pai/2 parameter line ///makes the ellipse EL2. ///MGSphereクラスは3次元空間における球を表すクラスである。 class MG_DLL_DECLR MGSphere :public MGSurface{ public: ///translation MG_DLL_DECLR friend MGSphere operator+ (const MGVector& v, const MGSphere& cyl); ///Scaling of the Sphere by a double. MG_DLL_DECLR friend MGSphere operator* (double scale, const MGSphere& cyl); ///////////////Constructor コンストラクタ////////////// ///Void constructor 初期化なしで柱面を生成する。 MGSphere(void); //Copy constructor. //MGSphere(const MGSphere& cyl); /// Construct a whole sphere from the center and the radius. MGSphere( const MGPosition& cntr, ///< Sphere center. double radius ///< Sphere radius. ); /// Construct a whole sphere from the center and the radius. ///Let MGUnit_vector N(B*M), M2(N*B). Then (M2,N,B) makes a orthonormal system, ///and this sphere is parameterized as: ///F(u,v)=cntr+radis*cos(v)(M*cos(u)+N*sin(u))+radis*sin(v)*B. MGSphere( const MGPosition& cntr, ///< Sphere center. double radius, ///< Sphere radius. const MGUnit_vector& B, ///=4. ///The extrapolation is done so that extrapolating length is "length" ///at the position of the parameter value "param" of the perimeter. MGSphere& extend( int perimeter, /// offset_c1( double ofs_value, ///<オフセット量 int& error ///<エラーコード 0:成功 -1:面におれがある ///< -2:曲率半径以上のオフセット不可 -3:面生成コンストラクタエラー )const; /// 指定点が面上にあるか調べる。(面上ならばtrue) ///Test if a point is on the Sphere. If on the Sphere, return true. bool on( const MGPosition& point,///