Divide arc by measurin leight and radius

Discussion of Common Lisp
Post Reply
WroooDude
Posts: 4
Joined: Thu Mar 11, 2010 4:49 pm

Divide arc by measurin leight and radius

Post by WroooDude » Thu Mar 11, 2010 4:57 pm

I need lisp that can divide any arc on segments by formula : X= L / 2*sqrt((R^2-(R-0.2)^2);
X - number of segments (first integer bigger than result of formula)
L - arc leight
R - radius of arc

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Divide arc by measurin leight and radius

Post by nuntius » Fri Mar 12, 2010 11:00 am

Here's a skeleton:

Code: Select all

(defun arc-segments (L R)
  "Returns X= L / 2*sqrt((R^2-(R-0.2)^2)"
  (/ L
     (* 2 (sqrt .... ) ) )

WroooDude
Posts: 4
Joined: Thu Mar 11, 2010 4:49 pm

Re: Divide arc by measurin leight and radius

Post by WroooDude » Sun Mar 14, 2010 1:03 pm

could you be more precisely? please...

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Divide arc by measurin leight and radius

Post by nuntius » Sun Mar 14, 2010 8:22 pm

To calculate R^2, use (expt R 2). Beyond that, I could write the whole formula, but feel that you might gain more by filling in the blanks.

WroooDude
Posts: 4
Joined: Thu Mar 11, 2010 4:49 pm

Re: Divide arc by measurin leight and radius

Post by WroooDude » Mon Mar 15, 2010 12:12 pm

OK, I get X from arc that I selected, but how to round result (x=7.2545) to first bigger integer?
and than how to make code to divide that selected arc to X segments?
THANKS....

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Divide arc by measurin leight and radius

Post by nuntius » Mon Mar 15, 2010 2:33 pm

For rounding, you probably want CEILING.

As to dividing the arc, how is it currently represented?

WroooDude
Posts: 4
Joined: Thu Mar 11, 2010 4:49 pm

Re: Divide arc by measurin leight and radius

Post by WroooDude » Tue Mar 16, 2010 11:50 am

i made it!!!
thanks....
regards

Post Reply