Re: Curvature, radius, etc. in VB

From: Gerald Hernandez (Cablewizard_at_spam_remove@Yahoo.com)
Date: 10/08/04


Date: Thu, 7 Oct 2004 23:22:37 -0600


Well, I don't have time to give you the math at the moment, but thought I would pass on the common procedure for doing this. Since it pretty much requires a picture, see attached.

In the illustation...
P1 is your first end point
P2 is your second end point
P3 is the arbitrary third point on the arc
P4 is the center point of line segment A
P5 is the center point of line segment B

A is the line segment created by P1 - P3
B is the line segment created by P3 - P2
we could also use the line C created by P1 - P2
note the right angles.
note that the center point of the arc/circle lies at the intersection of the projection of perpendicular vectors from the center of each line segment.
note that combination of the center point with P4 (segment F) and P3 (segment E) would result in a right triangle.
same goes for the segment D and segment E. in fact, the same would apply to any arbitrary set of arc chords we used.
mathematically speaking, we have enough information to calculate all the unknowns.

if you are good at Trigonometry, you might recognize that you could use trig to calculate the unknowns.
we can calculate the length from P4 to P3 easy enough.
we can calculate the angle bisector of P1-P3-P2 easy enough.
then using trig with the 2 known angles, (well, 3 actually since they must total 180), and length of one side of a right triangle, that would give us the length of E or F. Which happens to be our Radius.
from there, we can easily calculate the center point for the arc/circle.

alternatively, if you are good with vector geometry and algebra, you can calculate the vectors of the segments and their corresponding perpendicular normals, then compute the intersection. This is my personal favorite method to use. Less prone to rounding and precision errors. Plus, once you determine the various parameters, they can be directly plugged into the vectors to get the actual points involved.

mull over what I've shown you so far. hopefully a light will come on and you will be on your way.
otherwise, if and when I get a chance to follow up further, I will pass along more info.

Gerald

"YYZ" <notapplicable> wrote in message news:Os9VK6NrEHA.376@TK2MSFTNGP14.phx.gbl...
>
> "Gerald Hernandez" <Cablewizard@spam_remove@Yahoo.com> wrote in message
> news:#UIchWMrEHA.2588@TK2MSFTNGP12.phx.gbl...
> > What you are looking for is a classic "3 Point Arc" method.
>
> First, let me say, "Wow." I honestly hadn't considered many of these points.
> I'll try to answer them, but keep in mind that nothing has been decided as of
> yet
>
> > 3 points are the minimum required to engineer an arc that intersects these
> > points.
> > Good thing you want a circular arc and not an elliptical one, as 3 points
> > couldn't define an ellipse.
>
> I haven't reasoned that one out yet, but I'll trust you. <g>
>
> > There are many ways of doing this, some better than others.
> > The "best" choice depends on a number of factors, just a couple real
> > important ones are...
> > How does your application define and Arc?
>
> Not real sure. I was planning on storing 3 points, and then storing the length
> of the arc in feet (as measured by bits per pixel and scale -- 1/4 inch = 1
> foot, etc.)
>
> > Which is more important, fast rendering or mathematical accuracy?
>
> Probably accuracy. But I only say that because once I figure out where they
> want to put the arc, and have the 3 points, then I can store the resulting EMF
> file instructions and reproduce at will.
>
> > What sort of units are you working with, Integers, Doubles, etc.
>
> Doubles during calculation, then converting to Longs so that the API draw
> functions would work.
>
> > Are you working in GDI model space or Engineering model space. In short, do
> > your Y values increase or decrease as you go up, and are your Arc angles
> > measured clockwise or counterclockwise?
>
> GDI model space. And honestly, I don't nkow if clockwise or counterclockwise.
> Basically, I know that for the api calls you can change the orientation.
>
> > I have a Geometry Objects framework that I might be able to pull some things
> > out of to help.
> > I define an Arc using Center, Start Angle, Sweep Angle, and Radius, using
> > Engineering model space and Double precision.
>
> That would be great if you have the time. I think my main problem is that I
> don't know how to figure out the center, given the 3 points. If I did, then
> I'd know the bounding rectangle for the circle, and I'd already have the 2
> points needed for the API call.
>
> I wish there was a formula that would take 3 points and tell me the center.
> Either would work.
>
> Matt
>
>




Arc2.gif

Relevant Pages

  • Re: Curvature, radius, etc. in VB
    ... want the distance of the line, not the arc). ... P5 is the center point of line segment B ... note the right angles. ... >> Are you working in GDI model space or Engineering model space. ...
    (microsoft.public.vb.general.discussion)
  • Re: Curvature, radius, etc. in VB
    ... > How does your application define and Arc? ... I know that for the api calls you can change the orientation. ... > I define an Arc using Center, Start Angle, Sweep Angle, and Radius, using ... > Engineering model space and Double precision. ...
    (microsoft.public.vb.general.discussion)
  • Re: Curvature, radius, etc. in VB
    ... What you are looking for is a classic "3 Point Arc" method. ... Are you working in GDI model space or Engineering model space. ... I define an Arc using Center, Start Angle, Sweep Angle, and Radius, using ...
    (microsoft.public.vb.general.discussion)
  • Re: People saying the Angle/Joe segment is stupid cant see the big picture...
    ... Angle win the World Title and have the two face off at BFG'07... ... Could be the best booked feud of the year if done right... ... In a segment that had nothing to do with Sunday's PPV... ... think BFG will be a good show at worst. ...
    (rec.sport.pro-wrestling)
  • Re: Amount of span
    ... on the other side of the pin for his backing session? ... I don't follow that the arc would decrease, ... (Relative to the angle the the ... What if the span were only increased to 165cm instead of 180cm. ...
    (rec.sport.rowing)

Loading