[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: pcb GL can't render stretched arcs



2011/7/14 Andrew Poelstra <asp11@xxxxxx>:
> On Wed, Jul 13, 2011 at 01:01:34PM -0700, Colin D Bennett wrote:
>> On Wed, 13 Jul 2011 10:02:28 -0600
>> Mark Rages <markrages@xxxxxxxxx> wrote:
>>
>> > Stretched arcs are a misfeature.  Can they be deprecated?
>> >
>> > Otherwise, they are just another object that cannot be rotated at
>> > arbitrary angles.
>>
>> There is no inherent reason elliptical arcs cannot be rotated
>> arbitrarily.  Any restriction on such rotation is simply due to
>> implementation faults in pcb.
>>
>
> The reason I bring this up is that the IsPointOnArc() in search.c
> assumes a circular arc right now. ("Distance from elliptical arc
> segment" is quite a tricky computational problem.)
>
> You can see this problem by drawing an stretched arc and trying
> to select and move it.
>
> Being a math major and all, you'd think I could fix this, but it
> eludes me...
>
Good page: http://www.maa.org/joma/Volume8/Kalman/General.html

CCW rotation through angle alpha will give the following equation
Eq1 : 1 - A*x² - B*x*y - C*y² = 0
where
A = cos(alpha)²/a²+sin(alpha)²/b²
B = 2*cos(alpha)*sin(alpha)*(1/a²-1/b²)
C = sin(alpha)²/a²+cos(alpha)²/b²
and a is half axis length along x in non rotated state and b is half
axis length along y in non rotated state.

The ellipse should have the attributes,
x centerpoint
y centerpoint
a half Axis length along X when non rotated
b half Axix length along y when non rotaded
alpha Rotation angle (in ccw direction)
maybe even the A,B and C so they are only calculated once.

Check if point px,py is on rotaded elliptic arc:
1) Translate point to use ellipse center as origin,
Px = px-x
Py = py-y
2) Insert Px, Py in Eq1
 lval equal 0 -> point is exactly on arc
 lval above zero -> point is inside arc
 lval below zero -> point is outside arc


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user