home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
vis-ftp.cs.umass.edu
/
vis-ftp.cs.umass.edu.tar
/
vis-ftp.cs.umass.edu
/
pub
/
Software
/
ASCENDER
/
model.tar
/
model-board-1
/
camera-models.lisp
< prev
next >
Wrap
Lisp/Scheme
|
1994-04-11
|
2KB
|
81 lines
(in-package 'cme)
#|
(user::maybe-compile-file-load "~/cme/radius/model-board-1/camera-models.lisp")
|#
(defvar *model-units-to-feet* (/ 500.0 12))
(defun read-control-points (path)
(with-open-file (st path)
(loop for line = (read-line st nil nil)
while line
for control-point
= (let* ((pos 0)
thing)
(flet ((read-number (&optional (scale *model-units-to-feet*))
(multiple-value-setq (thing pos) (read-from-string line nil nil :start pos))
(and (numberp thing) (* scale thing))))
(let ((control-point (list (read-number 1) (read-number) (read-number) (read-number)
(ic::substring line pos ))))
(when (cadr control-point)
control-point))))
when control-point collect control-point)))
(defun get-gcp-with-id (fs id)
(loop for cp in (inferiors fs)
when (equal (control-pt-id cp) id)
return cp))
(defun add-control-points-from-table (control-point-list)
(loop with fs = (or (car (feature-sets *mb1-3d-world*))
(let ((fs (make-instance '3d-feature-set :name "MB1 GCPs")))
(add-feature-set fs *mb1-3d-world*)
fs))
for (id x y z descr) in control-point-list
for cp = (or (get-gcp-with-id fs id)
(add-object (make-instance 'conjugate-point-object :x x :y y :z z
:world (world fs)
:name (format nil "GCP ~d" id)
:control-pt-id id
)
fs))
do (set-origin cp x y z)
(setf (get-prop cp :description) descr)
))
(defun fix-control-pt-ids (fs)
(loop for cp in (inferiors fs)
unless (control-pt-id cp)
do (let ((name (object-name cp)))
(setf (control-pt-id cp) (read-from-string name nil nil :start 4)))))
(defparameter *model-board-1-control-points*
(read-control-points (merge-model-board-1-pathname "bd1gt.dat")))
(setf (get-prop *mb1-3d-world* :control-points) *model-board-1-control-points*)
#|
(dump-feature-sets (merge-model-board-1-pathname "gcp.fs")
(feature-sets *mb1-3d-world*))
(dump-site *mb1-3d-world* (merge-model-board-1-pathname "mb1.site"))
|#
#|
(let ((*2d-world-mapping-alist* '(("2d World j1.g" . "MB1-j1 2d World"))))
(setf (feature-sets *mb1-3d-world*) (load-feature-sets (merge-model-board-1-pathname "gcp.fs"))))
(setf (feature-sets *mb1-3d-world*) nil)
(fix-control-pt-ids (car (feature-sets *mb1-3d-world*)))
(add-control-points-from-table *model-board-1-control-points*)
(load-site (merge-model-board-1-pathname "mb1.site"))
|#