2

dxflibライブラリを使用して DXF パーサーを開発しています。楕円の解析に問題があります。

楕円を解析すると、次のデータを受け取ります。

struct DL_EllipseData 
{
    /*! X Coordinate of center point. */
    double cx;
    /*! Y Coordinate of center point. */
    double cy;

    /*! X coordinate of the endpoint of the major axis. */
    double mx;
    /*! Y coordinate of the endpoint of the major axis. */
    double my;

    /*! Ratio of minor axis to major axis. */
    double ratio;
    /*! Startangle of ellipse in rad. */
    double angle1;
    /*! Endangle of ellipse in rad. */
    double angle2;
};

問題はangle1 != 0 AND angle2 != 2* Math.PI、楕円が開いているときに、そのジオメトリを表すアーク パスを計算できないことです。

たとえば、次の楕円を考えてみます。

ここに画像の説明を入力

これらはそのプロパティです:

ここに画像の説明を入力

ご覧のとおり、角度は次のとおりです。

angle1 = 0.81855 // 46 degrees
angle2 = 2.38934 // 136 degrees

しかし、楕円の写真(autocadから取ったものは角度がかなり違うようです)。

楕円を表す DXF ファイルのセクションに従います。

0
ELLIPSE
  5
A7
330
1F
100
AcDbEntity
  8
DL-Wall
 48
25.0
370
    -3
100
AcDbEllipse
 10
906.6576677029225
 20
906.657675539829
 30
0.0
 11
-641.4561777354752
 21
641.4561777354752
 31
0.0
210
0.0
220
0.0
230
1.0
 40
0.9999999999999978
 41
0.8185500151218715
 42
2.389346341916759

どのように適切な角度を計算する必要がありますか (また、円弧セグメントの始点と終点)?

4

1 に答える 1