newbie question
  Home FAQ Contact Sign in
comp.graphics.algorithms only
 
Advanced search
POPULAR GROUPS

more...

comp.graphics.algorithms Profile…
 Up
newbie question         


Author: Anja
Date: Nov 15, 2006 02:35

Hi everyone,

I have an application which aloows the user to click points on a screen
and run a spline through it. Now, till now I was always adding points
to the end of the list. So a new point was always added to the end.

Now, I want people to add points in the middle. I can easily calculate
the closest control point by drawing a line between the new point and
the control points and choosing the shortest line between them.

Now, my question is what is the best way to find out if the point
should be added before or after the closest point...so basically on
which side it belongs. Is there an elegant way to compute this?

Thanks,
Anja
3 Comments
Re: newbie question         


Author: News Reader
Date: Nov 15, 2006 09:11

Imho this does not sound like a very robust approach, but to keep it
close to your idea, why don't you take the closest line segment
instead of a point? Then insert between the start and end point of
the segment. Distance calculation between point and line segment can
be found in the FAQ.

NR
Show full article (0.99Kb)
no comments
Re: newbie question         


Author: Kenneth Sloan
Date: Nov 15, 2006 09:27

Anja wrote:
> Hi everyone,
>
> I have an application which aloows the user to click points on a screen
> and run a spline through it. Now, till now I was always adding points
> to the end of the list. So a new point was always added to the end.
>
> Now, I want people to add points in the middle. I can easily calculate
> the closest control point by drawing a line between the new point and
> the control points and choosing the shortest line between them.
>
> Now, my question is what is the best way to find out if the point
> should be added before or after the closest point...so basically on
> which side it belongs. Is there an elegant way to compute this?
>
> Thanks,
> Anja
>
Show full article (2.07Kb)
no comments
Re: newbie question         


Author: hoffmann
Date: Nov 15, 2006 09:47

Anja,

IMO you'll need a functional description with an independent
variable which is monotonously increasing. Some cases:

a) Curves, like in Photoshop (gradation curves).
y=f(x)
x is the independent variable and y(x) is the output.
For each x one has exactly one y.
A new point is inserted depending on its x-position.

b) A parametric curve like a distorted circle, not necessarily
(strictly) convex.
x=x(a)
y=y(a)
The independent variable (a) is e.g. the angle, referring to an
assumed center.
Each angle delivers exactly one point x(a), y(a).
A new point is inserted depending on its angle.
So far it's assumed that x(a)=(x+2*pi), y(a)=y(a+2*pi).
Show full article (0.92Kb)
no comments