Loading ...
Sorry, an error occurred while loading the content.

62Re: XP toolkit: questions about arcs

Expand Messages
  • Peter Olsson
    Jul 3, 2000
    • 0 Attachment
      Hi Chris,

      >I'm tackling an XP command involving arcs, and I'm wondering
      >if anyone can answer the following questions:
      >- Is there an easy way to get a point along a specified
      > arc, i.e. is there a function that takes an GARC2
      > structure and a parameter T between 0 and 1, and
      > returns the point corresponding to the given T on the
      > given arc?

      There are several ways to do this. Here is two of them:

      1. Do it yourself.

      GARC2 TheArc;
      float T; // 0 <= T <= 1
      GPOINT2 Pt; // Result

      PConv(TheArc.Circle.Center.x, TheArc.Circle.Center.y, TheArc.Circle.Radius, TheArc.SAng+TheArc.AngW*T, &Pt);

      2. Use the T conversion functions.

      GARC2 TheArc;
      float T; // 0 <= T <= 1
      GPOINT2 Pt; // Result
      ARC2 Arc={sizeof(ARC2), ET_ARC2};

      Arc.Arc=TheArc;

      ECalPt2((pENTREC)&Arc, T, &Pt);

      >- How would one utilize the toolkit to go about deriving
      > an arc that fits three given points? I'm trying to
      > do something similar to what the ARCB command does in
      > CC2, and I'm assuming that there is a toolkit function
      > that fits an arc to three given points, but I can't
      > find it.


      There is (to my knowledge) no function that will do all of it for you. However by using PConv, Dist2P, Angle and IntL2 you will get ride of the trig and only work out the geometry.

      I have define some Ex functions (PConvEx, Dist2PEx etc) that works on GPOINT2:s rather than two floats. I don't know if it is included in the toolkit distribution or not. If not let me know and I'll send you the files. They also include some glue routines not provided in the toolkit.

      Peter
    • Show all 4 messages in this topic