View Full Version : Finding the midpoint
tflaherty
2005-05-19, 09:45 PM
The cabinet routine I'm working on now drawers the drawer fronts and I want to show a 1" diameter circle 1" below the top line of the drawer to represent the draw pull. What's the easiest way to find the midpoint of that line.
madcadder
2005-05-19, 10:01 PM
You will already have |pt1| and |pt2| from making the top line
(setq |pt3| (mapcar '+
|pt1|
(mapcar '/
(mapcar '- |pt2| |pt1|)
'(2.0 2.0 2.0)
)
)
)
From there you can POLAR down the distance you need.
tflaherty
2005-05-19, 10:18 PM
2 questions
what does the line '(2.0 2.0 2.0) do?
and what are the "|" around the points for?
madcadder
2005-05-19, 10:25 PM
what does the line '(2.0 2.0 2.0) do?
dividing the x,y,z by two
and what are the "|" around the points for?
Nothing at all. I confuse everyone with that. Sorry.
When I define a vaiable instead of calling it: PT1
I call it: |pt1|
It's just easier for me to find my variables that way.
(plus, it looks :cool: )
Tod
tflaherty
2005-05-20, 12:08 AM
works great thanks!!
jack.foster
2006-02-05, 02:20 AM
When someone helps me I like to thank them and this little program helped me find the midpoint of two picked points so I wanted to thank you very much for posting this. Sincerely, Jack Foster.
You will already have |pt1| and |pt2| from making the top line
(setq |pt3| (mapcar '+
|pt1|
(mapcar '/
(mapcar '- |pt2| |pt1|)
'(2.0 2.0 2.0)
)
)
)
From there you can POLAR down the distance you need.
aicm.44794
2006-02-06, 02:14 PM
Tim,
Why not use the one of the cabinet proggy's found on http://www.archidigm.com/.com?
They already come with what you are looking for plus a whole lot more. No sense in reinventing the wheel.
Larry
T.Willey
2006-02-06, 05:22 PM
You will already have |pt1| and |pt2| from making the top line
(setq |pt3| (mapcar '+
|pt1|
(mapcar '/
(mapcar '- |pt2| |pt1|)
'(2.0 2.0 2.0)
)
)
)
From there you can POLAR down the distance you need.
Another way to write this is:
(setq |pt3|
(mapcar
'(lambda (a b)
(/ (+ a b) 2.0)
)
|pt1|
|pt2|
)
)
Just an FYI.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.