Академический Документы
Профессиональный Документы
Культура Документы
e
origin for a rotate d m ode l
Determining the rotation angles and axes for a rotated model is usually
straightforward. However calculating a suitable origin and model extent requires
some thought and some 3D coordinate geometry. Therefore a macro is available
to assist with these calculations, and a listing is given overleaf. You can also
download a copy from the Datamine Australia support web site
(www.datamine.com.au)
The data file is first rotated through the required angles using CDTRAN. The
origins are set to 0,0,0 for both the original and the rotated data. The minimum
and maximum of the new X,Y,Z values can then be calculated using the STATS
and FIELD commands. A user defined value can be subtracted from each
minimum and added to each maximum to provide a margin around the volume.
Next define a temporary file containing three fields X,Y,Z with one record, with
values equal to the minimum values in the rotated system. These minimum
values are the origin of the rotated model in the rotated system. If these values
are rotated (CDTRAN) using the inverse rotation (@INVERSE=1), then the new
values will be the required origin in the world (non rotated) coordinate system.
The corresponding origin in the rotated system will be 0,0,0.
!REM Find the XYZ min & max in the transformed system.
!STATS &IN(T1),&OUT(T2),*F1(X),*F2(Y),*F3(Z)
!FIELD $EXIST#=T2,$RECS#=1,$XMIN#=MINIMUM,$XMAX#=MAXIMUM
!FIELD $EXIST#=T2,$RECS#=2,$YMIN#=MINIMUM,$YMAX#=MAXIMUM
!FIELD $EXIST#=T2,$RECS#=3,$ZMIN#=MINIMUM,$ZMAX#=MAXIMUM
!REM Add the margin
!LET $XMIN#={$XMIN#-$MARG#}
!LET $XMAX#={$XMAX#+$MARG#}
!LET $YMIN#={$YMIN#-$MARG#}
!LET $YMAX#={$YMAX#+$MARG#}
!LET $ZMIN#={$ZMIN#-$MARG#}
!LET $ZMAX#={$ZMAX#+$MARG#}