New topic: Geometry Question
<http://forums.realsoftware.com/viewtopic.php?t=31468> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message DaveS Post subject: Geometry QuestionPosted: Tue Dec 08, 2009 1:24 am Joined: Sun Aug 05, 2007 10:46 am Posts: 1808 Location: San Diego, CA I can't believe that I am unable to come up with a simple solution to this Given two sets of points.... X1,Y1 and X2,Y2... defines a line of course What I need to do if adjust the given X2,Y2 point to make sure the resultant line is alway at an even multiple of 45 degrees. 0, 45, 90, 135, 180, 225, 270 or 315 Now I don't really care about the specific angle [ie.. a solution that does not involve Sine/Cosine match is preferred] I just need to snap the line on the screen as the user moves the mouse around the X1,Y1 center point For you Windows folks... this is the EXACT same functionality as in MSPAINT when you draw a line holding down the SHIFT key _________________ Dave Sisemore MacPro, OSX 10.5.8 RB2009r2 Top Blake Post subject: Re: Geometry QuestionPosted: Tue Dec 08, 2009 1:47 am Joined: Fri Sep 30, 2005 8:39 pm Posts: 250 Location: Arlington, TX Are you calculating the angle at present to make sure its not a multiple of 45 or are you starting from scratch? Top timhare Post subject: Re: Geometry QuestionPosted: Tue Dec 08, 2009 1:49 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 6902 Location: Portland, OR USA You want one of the following to be true: Y2 - Y1 = 0 X2 - X1 = 0 Abs(Y2 - Y1) = Abs(X2 - X1) HTH, Tim Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
