• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Help with maths...snif,sniff

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello!!!
ok, i have to do a maths problem sheet...and i am stuck...can u guys help me out?
thanks!!
e) give the outline of an efficient algorithm to test if a point is inside a rectangle.
f) how would you test whether two circles intersect
thanks!!!
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Programming Diversions. Post followups there.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by mike brindley:
f) how would you test whether two circles intersect


One way is to test if the distance between their centers is less than the sum of their radii.
 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


give the outline of an efficient algorithm to test if a point is inside a rectangle.


Given the point's co-ordinates x,y
If (x >= Xa) and (x <= Xb)
and if (y >= Ya) and (y <= Yb) then point x,y is inside the rectangle,
where the co-ordinates of the four points are Xa,Ya ; Xa,Yb ; Xb,Ya ; Xb,Yb.
Or , more concisely
Xa <= x >= Xb and Ya <= y >= Yb
I think that works ,as long as you are given the points and rectangles co-ordinates.
[ August 25, 2003: Message edited by: HS Thomas ]
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds a lot like homework problems to me.
--Mark
 
fred fredricks
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah its homework...i have done like 15 questions, i only have a few left...
ie, the ones i just couldnt figure out how to do, thats why i ask for help....
its ok right?
thanks...
 
Mark Herschberg
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some people try to get homework problems done for them by posting on this site. You were upfront about it.
I just wanted to make it clear to other posters that they shouldn't solve the problems outright, but rather give you advice and suggestions. I think that is fine.
I'm not sure if this is quite the right forum for it, in that this forum is for problem discussion, and we would have to minimize discussion in order to not do your work for you.
--Mark
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic