Click here to Skip to main content
11,716,249 members (87,633 online)
Rate this: bad
good
Please Sign up or sign in to vote.
how to draw arc ("real-time" like in CAD) from 3 points - precisely, how check (from cursor)it arc will be clockwise or counter-clockwise

UPDATE:

http://a.imageshack.us/img230/2429/arcs.gif

i know how to draw arc like this, but i dont know how to find when mouse cross the segment between points and when i must change direction Blush | :O

i try use soluction from this article OpenS-CAD, a simple 2D CAD application[^]but it not work proertly
Posted 31-Aug-10 11:26am
Edited 1-Sep-10 1:20am
v5
Comments
HassBlass at 1-Sep-10 10:44am
   
i had problem, because i dont remember the angle can be -360 to 360, not 0 to 360 :D
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Do you asking about some math to calculate angle between 2 vectors to check the arc? You mentioned about 3 points and i asume there is something like this:

[how do i see this]

then you need to calculate angle or check dot product between 2 vectors and according to result you will be able to say if the arc is clockwise or counter-clockwise.

I'm not sure if this is such low level problem but if you need any other help with math-drawing feel free to ask. Stuff like this is kind of my hobby Wink | ;)
  Permalink  
Comments
HassBlass at 1-Sep-10 5:14am
   
not exactly what I want, i corrected my question
helianthus87 at 1-Sep-10 7:38am
   
So youre mooving cursor according the arrow and need to find yout if the cursor is below or above line defined by 2 red points, right? If that so all you need to do is get equation of line y=a*x+b then having a,b (you can get it solving 2 equations). Lets say you have cursor P4(cx,cy), then calculate y=a*cx+b and if y
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you work out if it's clockwise or counterclockwise from the relative position of the points, surely ?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 599
1 Richard MacCutchan 280
2 Maciej Los 275
3 OriginalGriff 160
4 F-ES Sitecore 135
0 Sergey Alexandrovich Kryukov 1,003
1 Richard MacCutchan 430
2 CHill60 415
3 Maciej Los 399
4 OriginalGriff 385


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 1 Sep 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100