Denis Cadar Posted April 8, 2021 Posted April 8, 2021 "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. Quote
CyberAngel Posted April 9, 2021 Posted April 9, 2021 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. Quote
rkmcswain Posted April 9, 2021 Posted April 9, 2021 In the meantime, the regular POLYGON command allows you to draw a polygon inscribed within a square. Then this lisp routine will convert the polygon to a circle. Quote
BIGAL Posted April 10, 2021 Posted April 10, 2021 This was answered some where else a couple of clues, get-coordinates and getclosestpointto. Look up these lisp functions. Quote
Recommended Posts
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.