segunda-feira, 21 de Dezembro de 2015 às 14:09:30 UTC, Raquel Oliveira escreveu:
> I'm a beginner at racket and I am finding it difficult to make a list of 
> lists of points follow an elliptical path and also rotate them so that the 
> shape that they make it's facing the centre of the ellipse. I can't make a 
> union on this list either. Can anyone explain me a procedure to do this, 
> please.


It's quite a lot, but it's what it takes for what I want to do. The problem 
that I was refering to is in (define (elipse-petalas p dx dy h mov e a0 a1 da). 
I hope the code is clear enough.

(define (trelica-espacial curvas)
  (let ((as (car curvas))
        (bs (cadr curvas))
        (cs (caddr curvas)))
    (nos-trelica as)
    (nos-trelica bs)
    (barras-trelica as cs)
    (barras-trelica bs as)
    (barras-trelica bs cs)
    (barras-trelica bs (cdr as))
    (barras-trelica bs (cdr cs))
    (barras-trelica (cdr as) as)
    (barras-trelica (cdr bs) bs)
    (if (null? (cdddr curvas))
        (begin
          (nos-trelica cs)
          (barras-trelica (cdr cs) cs))
        (begin
          (barras-trelica bs (cadddr curvas))
          (trelica-espacial (cddr curvas))))))

(define (treliça-petala p dx dy h)
  (let* ((p1 (+xyz p  (/ dx 19) (-( / dy 17/4)) (/ h 5000/951)))
         (p2 (+xyz p (/ dx 20) 0 (/ h 5000/953)))
         (p3 (+xyz p (/ dx 19) ( / dy 17/4)(/ h 5000/951)))
         (p4 (+xyz p (- (/ dx 100)) (- (/ dy (/ 17 2))) (/ h 23/10)))
         (p5 (+xyz p (- (/ dx 100)) (/ dy 17/2) (/ h 23/10)))
         (p6 (+xyz p  (/ dx 360/57) (- (/ dy 2)) (/ h 23/12)))
         (p7 (+xyz p (/ dx 360/62) 0 (/ h 23/12)))
         (p8 (+xyz p  (/ dx 360/57) (/ dy 2) (/ h 23/12)))
         (p9 (+xyz p (- (/ dx (/ 360 8))) (- (/ dy (/ 17 2))) (/ h (/ 23 18))))
         (p10 (+xyz p (- (/ dx 360/8)) (/ dy 17/2) (/ h 23/18)))
         (p11 (+xyz p  (/ dx 36/4) (- (/ dy 17/6)) (/ h (/ 23 20.5))))
         (p12 (+xyz p (/ dx (/ 36 4)) 0 (/ h (/ 23 20.5))))
         (p13 (+xyz p  (/ dx 36/2) (/ dy 17/6) (/ h (/ 23 20.5))))
         (p14 (+xyz p (-(/ dx (/ 36 3))) (- (/ dy (/ 17 2))) (/ h (/ 23 20))))
         (p15 (+xyz p (- (/ dx 36/3)) (/ dy 17/2) (/ h 23/20)))
         (p16 (+xyz p (-(/ dx 36/4)) (-(/ dy 17/3)) (+ h 0.5)))
         (p17 (+xyz p (- (/ dx 36/4)) 0 (/ h (/ 23 22.2))))
         (p18 (+xyz p (-(/ dx 36/4)) (/ dy 17/5) (/ h (/ 23 21.5))))
         (p19 (+xyz p (-(/ dx 36/20)) (- (/ dy (/ 17 5))) (/ h 23/20)))
         (p20 (+xyz p (-(/ dx (/ 36 20))) (/ dy (/ 17 2)) (/ h 23/20)))
         (p21 (+xyz p (-(/ dx (/ 36 29))) (- (/ dy (/ 17 2))) (/ h (/ 23 21))))
         (p22 (+xyz p (-(/ dx 36/29)) (/ dy 17/2) (/ h (/ 23 21))))
         (p23 (+xyz p (-(/ dx 36/15)) (/ dy 17/4) (/ h 23/21))))
    (trelica-espacial
      (list
       (list p1 p2 p3)
       (list p4 p5 )
       (list p6 p7 p8)
       (list p9 p10)
       (list p11 p12 p13)
       (list p14 p15)
       (list p16 p17 p18)
       (list p19 p20)
       (list p21 p22 p23)))))
#|(treliça-petala (xyz 0 0 0) 25 17 23)|#

;petala

(define (pano-petala p dx dy h mov e)
  (let* ((p1 (+xyz p (- (/ dx 18)) (- (/ dy (/ 17 4))) (/ h(/ 5000 953))))
         (p2 (+xyz p (- (/ dx (/ 360 67))) (- (/ dy 2)) (/ h (/ 23 12))))
         (p3 (+xyz p (- (/ dx (/ 36 7))) (- (/ dy (/ 17 8))) (/ h (/ 23 17))))
         (p4 (+xyz p (/ dx (/ 36 29)) (- (/ dy (/ 17 2))) (/ h 23/21)))
         (p5 (+xyz p (/ dx 36/29) (/ dy 17/2) (/ h 23/21)))
         (p6 (+xyz p 0 (/ dy 17/4) h))
         (p7 (+xyz p (- (/ dx 36/7)) (/ dy 17/8) (/ h 23/17)))
         (p8 (+xyz p (- (/ dx 360/67)) (/ dy 2) (/ h 23/12)))
         (p9 (+xyz p (- (/ dx 18)) (/ dy 17/4) (/ h 5000/953)))
         (p10 (+xyz p (/ dx 9) (/ dy 17/10) (/ h 23/15)))
         (p11 (+xyz p (/ dx 90/19) (/ dy 17/10) (/ h 23/21))))
    (move
     (rotate
     (union
      (thicken
       (loft
        (list
         (spline (list p p1 p2 p3 p4))
         (spline (list p4 p6 p7 p8 p9 p)))) e)
      (thicken
       (loft
        (list
         (spline (list p4 p6 p7 p8 p9))
         (spline (list p9 p10 p11 p5)))) e))
     pi)
     (x mov))))

#|(pano-petala (xyz 0 0 0) 25 25 23 70 0.08)|#


(define (petala p dx dy h mov e)
  (union
     (pano-petala p dx dy h mov e)
     (treliça-petala p dx dy h)))
#|(petala (xyz 0 0 0) 25 25 23 0 0.08)|#


(define (elipse-petalas p dx dy h mov e a0 a1 da)
  (if (> a0 a1)
      #T
       (begin
         (rotate
          (petala p dx dy h mov e)
          a0)
         (elipse-petalas p dx dy h mov e (+ a0 da) a1 da))))

(elipse-petalas (xyz 0 0 0) 12 12 23 33 0.08 0 2pi (/ pi 8))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to