From: Sungwoo Lim
Subject: [Q] Question for LOOP
Date: 
Message-ID: <sungwoo-0304011314200001@gorecki.cad.strath.ac.uk>
Hello, 

How can I get the four different result as (t1x, t1y) for the 'min-x, min-y',
(t2x, t2y) for the 'max-x, max-y', (t3x, t3y) for the 'max-x, min-y', and 
(t4x, t4y) for the 'min-x, max-y' respectively.
What should I add to below code?
Thanks for your help.

Sungwoo 

;--------------------------
(setf max-distance 0
      temp-room-x 0
      temp-room-y 0)
(loop for x-value in (list min-x max-x max-x min-x) 
      for y-value in (list min-y max-y min-y max-y)
      do (loop for i from 0 to stroke-index
               as delta-x = (- (aref stroke-array-x i) x-value)
               as delta-y = (- (aref stroke-array-y i) y-value)
               do (if (> (sqrt (+ (* delta-x delta-x) (* delta-y
delta-y))) max-distance)
                    (setf max-distance (sqrt (+ (* delta-x delta-x) (*
delta-y delta-y)))
                          temp-room-x (aref stroke-array-x i)
                          temp-room-y (aref stroke-array-y i))
                    nil)
               finally (setf t1x temp-room-x
                             t1y temp-room-y)))
;--------------------------

-- 

--
<^)++<
From: Sungwoo Lim
Subject: Solved the problem
Date: 
Message-ID: <sungwoo-0304011512120001@gorecki.cad.strath.ac.uk>
In article <························@gorecki.cad.strath.ac.uk>,
·······@cad.strath.ac.uk (Sungwoo Lim) wrote:

Hello,

I just solved the problem as below.
Sungwoo

;----
  (diagonal-point stroke-index)
  (loop for x-value in (list min-x max-x max-x min-x) 
        for y-value in (list min-y max-y min-y max-y)
        do (setf max-distance 0
                 temp-room-x 0
                 temp-room-y 0)
           (loop for i from 0 to stroke-index
                 as delta-x = (- (aref stroke-array-x i) x-value)
                 as delta-y = (- (aref stroke-array-y i) y-value)
                 do (if (> (sqrt (+ (* delta-x delta-x) (* delta-y
delta-y))) max-distance)
                      (setf max-distance (sqrt (+ (* delta-x delta-x) (*
delta-y delta-y)))
                            temp-room-x (aref stroke-array-x i)
                            temp-room-y (aref stroke-array-y i))
                      nil)
                 finally (vector-push-extend temp-room-x diagonal-point-x) 
                         (vector-push-extend temp-room-y diagonal-point-y)))

(defun diagonal-point (stroke-index)
    (setf diagonal-point-x (make-array 1 
                                       :adjustable t
                                       :fill-pointer 0))
    (setf diagonal-point-y (make-array 1 
                                       :adjustable t
                                       :fill-pointer 0)))

-- 
<^)++<