To have a concept of clockwise, there needs to be a
circle somewhere. The circle needs a center and
a radius. The center needs two points, call them
X and Y. Call the radius R. So somehow you need
three values, X, Y and R.
Two points could be (X1,Y1) and (X2,Y2). There are
a *lot* of possible circles that can go through these
two points. You need some more information.
Doing geometry with numbers is called "Computational
Geometry". It is a challenging but fun kind of
programming and is often the source of many bugs
in ordinary applications. For example, say you decide
to use a third point to help define your circle and
compute a radius. If all the points lie on a straight
line, the radius will be infinite. So you will need
some extra code to check for this.
Since so many problems are often found in geometric
code, many people strive to use only the
most well-tested algorithms. Even then, lots of
testing is required, and many times problems will
be found later.
To evaluate clockwise and counter-clockwise,
take a look at the atan2 function.
It should work perfectly the first time! - toma
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.