[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: Polar coordinate system support in KDiagram
From:       Joel Sing <jsing () river ! net ! au>
Date:       1999-09-22 2:57:25
[Download RAW message or body]

Hi Lotzi,

Lotzi Boloni wrote:

> > now, when KDiagramm development started again, can we expect polar coordinate
> > system support ?
> >
> > AFAIK even MS Excel doesn't have this feature, which is very usefull sometimes.
>
>   What exactly polar coordinate system support means in this case? Can you
> give some example?

Instead of giving X and Y coordinates (cartesian or rectangular coordinate
system) you specify an angle (theta) and a radius (r). This is far better explained
on paper :). As an example, in 2D space you give 2,2 in cartesian and PI/4, 2.829 in
polar (angle of PI/4 and radius of ~2.829. The following formulae allow you to
convert between coordinate systems:

    y = r cos(theta)
    x = r sin(theta)

    theta = ?? Can't remember this one - if you need it let me know :)
    r = sqrt(y^2 + x^2)

Polar is extremely useful for drawing circular patterns especially circles, and are
used extensively in computer graphics. For example the following can be used to draw
the outline of a circle in rectangular coordinates with radius of 2:

inc=48;
radius = 2;
for(n = 0; n < inc*2; n++){
    theta += PI/inc;
    putpixel(radius*cos(theta), radius*sin(theta));
}

Obviously the more intervals used the more accurate it will be.

If you need more info let me know and I'll see what I can chase up for you. I have a
collection of maths texts which explain it fairly throughly! ;-)

Cheers,

Joel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic