Jump to content

Circle in rectangle


Recommended Posts

Denis Cadar
"Write an AutoCAD command called CIRCLEC to draw a circle
constrained in a certain rectangular area on the screen. This area
rectangular will be given by the user through two opposite corners.
Here are some tips for writing the function that implements this command:
ƒ For the circle to be inside the rectangular area, first its center
it must be in that area, then the distances from its center to the boundaries of the area
rectangular must be greater than or equal to the radius. Write a function
(insidew corner0 corner1 pt) to check if a point is in
inside a rectangular area specified by a colon."

Please help me.

Link to post
Share on other sites
CyberAngel

Nobody here is going to write your function for you. However, I will give you a suggestion. Since you're dealing with a rectangle, you can assume that the circle inside that rectangle is bounded by another, smaller rectangle. In other words, you don't have to check every single point along the circumference to see if it's inside the outer rectangle, just the edges of that inner rectangle.

 

Looking at the assignment again, it seems like the "insidew" function is for validation. In other words, if the calling function provides a rectangle and a point (which you've already gotten from the user, along with a circumference), insidew should return True or False. If it's False, you can print an error message and quit.

 

Good luck with the project. The assignment is poorly worded, but that's typical.

Link to post
Share on other sites
BIGAL

This was answered some where else a couple of clues, get-coordinates and getclosestpointto. Look up these lisp functions.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...