/ *   
 
   *   P R O J E C T :   N y A R T o o l k i t C S 
 
   *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   *   T h i s   w o r k   i s   b a s e d   o n   t h e   o r i g i n a l   A R T o o l K i t   d e v e l o p e d   b y 
 
   *       H i r o k a z u   K a t o 
 
   *       M a r k   B i l l i n g h u r s t 
 
   *       H I T L a b ,   U n i v e r s i t y   o f   W a s h i n g t o n ,   S e a t t l e 
 
   *   h t t p : / / w w w . h i t l . w a s h i n g t o n . e d u / a r t o o l k i t / 
 
   * 
 
   *   T h e   N y A R T o o l k i t C S   i s   J a v a   e d i t i o n   A R T o o l K i t   c l a s s   l i b r a r y . 
 
   *   C o p y r i g h t   ( C ) 2 0 0 8 - 2 0 0 9   R y o   I i z u k a 
 
   * 
 
   *   T h i s   p r o g r a m   i s   f r e e   s o f t w a r e :   y o u   c a n   r e d i s t r i b u t e   i t   a n d / o r   m o d i f y 
 
   *   i t   u n d e r   t h e   t e r m s   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e   a s   p u b l i s h e d   b y 
 
   *   t h e   F r e e   S o f t w a r e   F o u n d a t i o n ,   e i t h e r   v e r s i o n   3   o f   t h e   L i c e n s e ,   o r 
 
   *   ( a t   y o u r   o p t i o n )   a n y   l a t e r   v e r s i o n . 
 
   *   
 
   *   T h i s   p r o g r a m   i s   d i s t r i b u t e d   i n   t h e   h o p e   t h a t   i t   w i l l   b e   u s e f u l , 
 
   *   b u t   W I T H O U T   A N Y   W A R R A N T Y ;   w i t h o u t   e v e n   t h e   i m p l i e d   w a r r a n t y   o f 
 
   *   M E R C H A N T A B I L I T Y   o r   F I T N E S S   F O R   A   P A R T I C U L A R   P U R P O S E .     S e e   t h e 
 
   *   G N U   G e n e r a l   P u b l i c   L i c e n s e   f o r   m o r e   d e t a i l s . 
 
   * 
 
   *   Y o u   s h o u l d   h a v e   r e c e i v e d   a   c o p y   o f   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e 
 
   *   a l o n g   w i t h   t h i s   p r o g r a m .     I f   n o t ,   s e e   < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > . 
 
   *   
 
   *   F o r   f u r t h e r   i n f o r m a t i o n   p l e a s e   c o n t a c t . 
 
   * 	 h t t p : / / n y a t l a . j p / n y a t o o l k i t / 
 
   * 	 < a i r m a i l ( a t ) e b o n y . p l a l a . o r . j p >   o r   < n y a t l a ( a t ) n y a t l a . j p > 
 
   *   
 
   * / 
 
 u s i n g   S y s t e m . I O ; 
 
 u s i n g   S y s t e m ; 
 
 u s i n g   S y s t e m . C o l l e c t i o n s . G e n e r i c ; 
 
 n a m e s p a c e   j p . n y a t l a . n y a r t o o l k i t . c s . c o r e 
 
 { 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
         / * * 
 
           *   S0n0000o00N y A R T o o l k i t n0tX000000<h
}W0~0Y00
 
           *   tX00000o00A R T o o l K i t n000000h0T Ng0Y00
 
           *   00000n0 }k0o00NNn00n0L0B00~0Y00
 
           *   < u l > 
 
           *   < l i > =jWjk000000  -   eQR;uPn0=jWjk000000g0Y00
 
           *   < l i > 00000000  -   eQR;uPn0P^g0Y00
 
           *   < l i > 	Yc00000  -   4 x 4 LRg0Y00
 
           *   < / u l > 
 
           * / 
 
         p u b l i c   c l a s s   N y A R P a r a m 
 
         { 
 
                 / * *   00000000g0Y00* / 
 
                 p r o t e c t e d   N y A R I n t S i z e   _ s c r e e n _ s i z e   =   n e w   N y A R I n t S i z e ( ) ; 
 
                 p r i v a t e   c o n s t   i n t   S I Z E _ O F _ P A R A M _ S E T   =   4   +   4   +   ( 3   *   4   *   8 )   +   ( 4   *   8 ) ; 
 
                 p r i v a t e   I N y A R C a m e r a D i s t o r t i o n F a c t o r   _ d i s t ; 
 
                 p r i v a t e   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x   _ p r o j e c t i o n _ m a t r i x   =   n e w   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x ( ) ; 
 
                 / * * 
 
                   *   000k0O(uY00_00n0000000000$P0000W0~0Y00
 
                   *   S0n000000o00A R T o o l K i t 2 . 7 k0N^\W0f0D00000000000000n0$Pg0Y00
 
                   * / 
 
                 p u b l i c   s t a t i c   N y A R P a r a m   c r e a t e D e f a u l t P a r a m e t e r ( ) 
 
                 { 
 
                         P a r a m L o a d e r   p m   =   n e w   P a r a m L o a d e r ( ) ; 
 
                         r e t u r n   n e w   N y A R P a r a m ( p m . s i z e ,   p m . p m a t ,   p m . d i s t _ f a c t o r ) ; 
 
                 } 
 
 	         / * * 
 
 	           *   i _ s t r e a m K00A R T o o l k i t n00000000000QW0f00<h
}W0_00000000ubW0~0Y00
 
 	           *   @ p a r a m   i _ s t r e a m 
 
 	           *   @ r e t u r n 
 
 	           *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	           * / 
 
 	         p u b l i c   s t a t i c   N y A R P a r a m   c r e a t e F r o m A R P a r a m F i l e ( S t r e a m R e a d e r   i _ s t r e a m ) 
 
 	         { 
 
 	 	         P a r a m L o a d e r   p m = n e w   P a r a m L o a d e r ( i _ s t r e a m ) ; 
 
 	 	         r e t u r n   n e w   N y A R P a r a m ( p m . s i z e , p m . p m a t , p m . d i s t _ f a c t o r ) ; 
 
 	         } 
 
                 / * * 
 
                   *   i n t r i n s i c   m a t r i x h0d i s t o r t i o n   c o e f f s 00000g00000000RgSW0~0Y00
 
                   *   @ p a r a m   i _ s i z e 
 
                   *   00000000n0000$P
 
                   *   @ p a r a m   i _ i n t r i n s i c _ m a t r i x 
 
                   *   3 x 3   m a t r i x 
 
                   *   S0n000000o00O p e n C V n0c v C a l i b r a t e C a m e r a 2 peL0QRY00i n t r i n s i c _ m a t r i x n0$Ph0TW0~0Y00
 
                   *   @ p a r a m   i _ d i s t o r t i o n _ c o e f f s 
 
                   *   4 x 1   m a t r i x 
 
                   *   S0n000000o00O p e n C V n0c v C a l i b r a t e C a m e r a 2 peL0QRY00d i s t o r t i o n _ c o e f f s n0$Ph0TW0~0Y00
 
                   * / 
 
                 p u b l i c   s t a t i c   N y A R P a r a m   c r e a t e F r o m C v C a l i b r a t e C a m e r a 2 R e s u l t ( i n t   i _ w ,   i n t   i _ h ,   d o u b l e [ ]   i _ i n t r i n s i c _ m a t r i x ,   d o u b l e [ ]   i _ d i s t o r t i o n _ c o e f f s ) 
 
                 { 
 
                         P a r a m L o a d e r   p m   =   n e w   P a r a m L o a d e r ( i _ w ,   i _ h ,   i _ i n t r i n s i c _ m a t r i x ,   i _ d i s t o r t i o n _ c o e f f s ) ; 
 
                         r e t u r n   n e w   N y A R P a r a m ( p m . s i z e ,   p m . p m a t ,   p m . d i s t _ f a c t o r ) ; 
 
                 } 
 
 	         p u b l i c   N y A R P a r a m ( N y A R I n t S i z e   i _ s c r e e n _ s i z e , N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x   i _ p r o j e c t i o n _ m a t , I N y A R C a m e r a D i s t o r t i o n F a c t o r   i _ d i s t _ f a c t o r ) 
 
 	         { 
 
 	 	         t h i s . _ s c r e e n _ s i z e = n e w   N y A R I n t S i z e ( i _ s c r e e n _ s i z e ) ; 
 
 	 	         t h i s . _ d i s t = i _ d i s t _ f a c t o r ; 
 
 	 	         t h i s . _ p r o j e c t i o n _ m a t r i x = i _ p r o j e c t i o n _ m a t ; 
 
 	         } 
 
 
 
 
 
 
 
 
 
                 p u b l i c   N y A R I n t S i z e   g e t S c r e e n S i z e ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ s c r e e n _ s i z e ; 
 
                 } 
 
 
 
                 / * * 
 
                   *   S0n0peo00A R T o o l K i t b__n0	YcLR0ԏW0~0Y00
 
                   *   @ r e t u r n 
 
                   *   [ r e a d   o n l y ] 	YcLR0ԏW0~0Y00
 
                   * / 
 
                 p u b l i c   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x   g e t P e r s p e c t i v e P r o j e c t i o n M a t r i x ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ p r o j e c t i o n _ m a t r i x ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00A R T o o l K i t b__n0jk0܈ck000000ԏW0~0Y00
 
                   *   @ r e t u r n 
 
                   *   [ r e a d   o n l y ] jk0܈ck00000000000
 
                   * / 
 
                 p u b l i c   I N y A R C a m e r a D i s t o r t i o n F a c t o r   g e t D i s t o r t i o n F a c t o r ( ) 
 
                 { 
 
                         r e t u r n   t h i s . _ d i s t ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00MRK00$P0-[W0~0Y00
 
                   *   @ p a r a m   i _ f a c t o r 
 
                   *   N y A R C a m e r a D i s t o r t i o n F a c t o r k0000Y00MR0c[Y000 }peo04 g0B00S0h00
 
                   *   @ p a r a m   i _ p r o j e c t i o n 
 
                   *   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x 000Y00MR0c[Y000 }peo01 2 g0B00S0h00
 
                   * / 
 
                 p u b l i c   v o i d   s e t V a l u e ( d o u b l e [ ]   i _ f a c t o r ,   d o u b l e [ ]   i _ p r o j e c t i o n ) 
 
                 { 
 
                         t h i s . _ d i s t . s e t V a l u e ( i _ f a c t o r ) ; 
 
                         t h i s . _ p r o j e c t i o n _ m a t r i x . s e t V a l u e ( i _ p r o j e c t i o n ) ; 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo00s(Wn0000000000	YfW0~0Y00
 
                   *   A R T o o l K i t n0a r P a r a m C h a n g e S i z e pek0vS_W0~0Y00
 
                   *   @ p a r a m   i _ x s i z e 
 
                   *   eW0D0000
 
                   *   @ p a r a m   i _ y s i z e 
 
                   *   eW0D0000
 
                   * / 
 
                 p u b l i c   v o i d   c h a n g e S c r e e n S i z e ( i n t   i _ x s i z e ,   i n t   i _ y s i z e ) 
 
                 { 
 
 	 	         d o u b l e   x _ s c a l e   =   ( d o u b l e )   i _ x s i z e   /   ( d o u b l e )   ( t h i s . _ s c r e e n _ s i z e . w ) ; / /   s c a l e   =   ( d o u b l e ) x s i z e   /   ( d o u b l e ) ( s o u r c e - > x s i z e ) ; 
 
 	 	         d o u b l e   y _ s c a l e   =   ( d o u b l e )   i _ y s i z e   /   ( d o u b l e )   ( t h i s . _ s c r e e n _ s i z e . h ) ; / /   s c a l e   =   ( d o u b l e ) x s i z e   /   ( d o u b l e ) ( s o u r c e - > x s i z e ) ; 
 
 	 	         / / 00000	Yf
 
 	 	         t h i s . _ d i s t . c h a n g e S c a l e ( x _ s c a l e , y _ s c a l e ) ; 
 
 	 	         t h i s . _ p r o j e c t i o n _ m a t r i x . c h a n g e S c a l e ( x _ s c a l e , y _ s c a l e ) ; 
 
 	 	         t h i s . _ s c r e e n _ s i z e . w   =   i _ x s i z e ; / /   n e w p a r a m - > x s i z e   =   x s i z e ; 
 
 	 	         t h i s . _ s c r e e n _ s i z e . h   =   i _ y s i z e ; / /   n e w p a r a m - > y s i z e   =   y s i z e ; 
 
                 } 
 
                 p u b l i c   v o i d   c h a n g e S c r e e n S i z e ( N y A R I n t S i z e   i _ s i z e ) 
 
                 { 
 
                         t h i s . c h a n g e S c r e e n S i z e ( i _ s i z e . w ,   i _ s i z e . w ) ; 
 
                         r e t u r n ; 
 
                 } 
 
                 / * * 
 
                   *   S0n0peo0000000000K00SKb|n0S0\O0~0Y00
 
                   *   < p > la  - 
 
                   *   S0n0Qto0NOg0Y00p~0ԏW0n0O(uo0g0M00`0Q0Q0f0O0`0U0D00
 
                   *   < / p > 
 
                   *   @ p a r a m   i _ d i s t _ m i n 
 
                   *   Sn0n e a r   p o i n t ( m m c[) 
 
                   *   @ p a r a m   i _ d i s t _ m a x 
 
                   *   Sn0f a r   p o i n t ( m m c[) 
 
                   *   @ p a r a m   o _ f r u s t u m 
 
                   *   S0SQ0S0MR0
 
                   *   @ s e e   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x # m a k e C a m e r a F r u s t u m R H 
 
                   * / 
 
                 p u b l i c   v o i d   m a k e C a m e r a F r u s t u m R H ( d o u b l e   i _ d i s t _ m i n ,   d o u b l e   i _ d i s t _ m a x ,   N y A R D o u b l e M a t r i x 4 4   o _ f r u s t u m ) 
 
                 { 
 
                         t h i s . _ p r o j e c t i o n _ m a t r i x . m a k e C a m e r a F r u s t u m R H ( t h i s . _ s c r e e n _ s i z e . w ,   t h i s . _ s c r e e n _ s i z e . h ,   i _ d i s t _ m i n ,   i _ d i s t _ m a x ,   o _ f r u s t u m ) ; 
 
                         r e t u r n ; 
 
                 } 
 
 
 
 
 
 	         / * * 
 
 	           *   000000000g0Y00
 
 	           * / 
 
 	         p r o t e c t e d   c l a s s   P a r a m L o a d e r 
 
 	         { 
 
 	 	         p u b l i c   N y A R I n t S i z e   s i z e ; 
 
 	 	         p u b l i c   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x   p m a t ; 
 
 	 	         p u b l i c   I N y A R C a m e r a D i s t o r t i o n F a c t o r   d i s t _ f a c t o r ; 
 
                         / * * 
 
                           *   i n t r i n s i c _ m a t r i x h0d i s t o r t i o n _ c o e f f s K000000000RgSY000
 
                           *   @ p a r a m   i _ w 
 
                           *   00000000ubBfn0;ub000
 
                           *   @ p a r a m   i _ h 
 
                           *   00000000ubBfn0;ub000
 
                           *   @ p a r a m   i _ i n t r i n s i c _ m a t r i x   3 x 3   m a t r i x   S0n000000o00O p e n C V n0c v C a l i b r a t e C a m e r a 2 peL0QRY00i n t r i n s i c _ m a t r i x n0$Ph0TW0~0Y00
 
                           *   @ p a r a m   i _ d i s t o r t i o n _ c o e f f s   4 x 1   v e c t o r   S0n000000o00O p e n C V n0c v C a l i b r a t e C a m e r a 2 peL0QRY00d i s t o r t i o n _ c o e f f s n0$Ph0TW0~0Y00
 
                           * / 
 
                         p u b l i c   P a r a m L o a d e r ( i n t   i _ w ,   i n t   i _ h ,   d o u b l e [ ]   i _ i n t r i n s i c _ m a t r i x ,   d o u b l e [ ]   i _ d i s t o r t i o n _ c o e f f s ) 
 
                         { 
 
                                 t h i s . s i z e   =   n e w   N y A R I n t S i z e ( i _ w ,   i _ h ) ; 
 
                                 / / d i s t   f a c t o r 
 
                                 N y A R C a m e r a D i s t o r t i o n F a c t o r V 4   v 4 d i s t   =   n e w   N y A R C a m e r a D i s t o r t i o n F a c t o r V 4 ( ) ; 
 
                                 v 4 d i s t . s e t V a l u e ( t h i s . s i z e ,   i _ i n t r i n s i c _ m a t r i x ,   i _ d i s t o r t i o n _ c o e f f s ) ; 
 
                                 d o u b l e   s   =   v 4 d i s t . g e t S ( ) ; 
 
                                 t h i s . d i s t _ f a c t o r   =   v 4 d i s t ; 
 
                                 / / p r o j e c t i o n   m a t r i x 
 
                                 t h i s . p m a t   =   n e w   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x ( ) ; 
 
                                 N y A R D o u b l e M a t r i x 3 3   r   =   n e w   N y A R D o u b l e M a t r i x 3 3 ( ) ; 
 
                                 r . s e t V a l u e ( i _ i n t r i n s i c _ m a t r i x ) ; 
 
                                 r . m 0 0   / =   s ; 
 
                                 r . m 0 1   / =   s ; 
 
                                 r . m 1 0   / =   s ; 
 
                                 r . m 1 1   / =   s ; 
 
                                 t h i s . p m a t . s e t V a l u e ( r ,   n e w   N y A R D o u b l e P o i n t 3 d ( ) ) ; 
 
                         }       	 	 
 
 	 	         / * * 
 
 	 	           *   jn00000g00000000RgSW0~0Y00
 
 	 	           *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	 	           * / 
 
 	 	         p u b l i c   P a r a m L o a d e r ( ) 
 
 	 	         { 
 
 	 	 	         d o u b l e [ ]   d f = { 3 1 8 . 5 , 2 6 3 . 5 , 2 6 . 2 , 1 . 0 1 2 7 5 6 5 2 0 6 6 5 8 4 8 6 } ; 
 
 	 	 	         d o u b l e [ ]   p j = { 	 7 0 0 . 9 5 1 4 7 0 2 9 9 2 2 4 5 , 0 , 3 1 6 . 5 , 0 , 
 
 	 	 	 	 	 	 	         0 , 7 2 6 . 0 9 4 1 8 1 6 5 3 5 3 6 7 , 2 4 1 . 5 , 0 . 0 , 
 
 	 	 	 	 	 	 	         0 . 0 , 0 . 0 , 1 . 0 , 0 . 0 , 
 
 	 	 	 	 	 	 	         0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 } ; 
 
 	 	 	         t h i s . s i z e = n e w   N y A R I n t S i z e ( 6 4 0 , 4 8 0 ) ; 
 
 	 	 	         t h i s . p m a t = n e w   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x ( ) ; 
 
 	 	 	         t h i s . p m a t . s e t V a l u e ( p j ) ; 
 
 	 	 	         t h i s . d i s t _ f a c t o r = n e w   N y A R C a m e r a D i s t o r t i o n F a c t o r V 2 ( ) ; 
 
 	 	 	         t h i s . d i s t _ f a c t o r . s e t V a l u e ( d f ) ; 
 
 	 	         } 
 
 	 	         / * * 
 
 	 	           *   00000K000QW0_0000g00000000RgSW0~0Y00
 
 	 	           *   @ p a r a m   i _ s t r e a m 
 
 	 	           *   @ t h r o w s   N y A R E x c e p t i o n 
 
 	 	           * / 
 
                         p u b l i c   P a r a m L o a d e r ( S t r e a m R e a d e r   i _ s t r e a m ) 
 
 	 	         { 
 
 	 	 	         t r y   { 
 
 	 	 	 	         / / 0QW0
 
 	 	 	 	         B y t e B u f f e r e d I n p u t S t r e a m   b i s = n e w   B y t e B u f f e r e d I n p u t S t r e a m ( i _ s t r e a m , 5 1 2 ) ; 
 
 	 	 	 	         i n t   s = b i s . r e a d T o B u f f e r ( 5 1 2 ) ; 
 
 	 	 	 	         b i s . o r d e r ( B y t e B u f f e r e d I n p u t S t r e a m . E N D I A N _ B I G ) ; 
 
 	 	 	 	         / / 0QW0_0000g0000000zl[
 
 	 	 	 	         i n t [ ]   v e r s i o n _ t a b l e = { 1 3 6 , 1 4 4 , 1 5 2 , 1 7 6 } ; 
 
 	 	 	 	         i n t   v e r s i o n = - 1 ; 
 
 	 	 	 	         f o r ( i n t   i = 0 ; i < v e r s i o n _ t a b l e . L e n g t h ; i + + ) { 
 
 	 	 	 	 	         i f ( s % v e r s i o n _ t a b l e [ i ] = = 0 ) { 
 
 	 	 	 	 	 	         v e r s i o n = i + 1 ; 
 
 	 	 	 	 	 	         b r e a k ; 
 
 	 	 	 	 	         } 
 
 	 	 	 	         } 
 
 	 	 	 	         / /  NW0j0Q00p0!qW0
 
 	 	 	 	         i f ( v e r s i o n = = - 1 ) { 
 
 	 	 	 	 	         t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 	 	 	         } 
 
 	 	 	 	         / / s i z e 
 
 	 	 	 	         t h i s . s i z e = n e w   N y A R I n t S i z e ( ) ; 
 
 	 	 	 	         t h i s . s i z e . s e t V a l u e ( b i s . g e t I n t ( ) , b i s . g e t I n t ( ) ) ; 
 
 
 
 	 	 	 	         / / p r o j e c t i o n   m a t r i x 
 
 	 	 	 	         t h i s . p m a t = n e w   N y A R P e r s p e c t i v e P r o j e c t i o n M a t r i x ( ) ; 
 
 	 	 	 	         d o u b l e [ ]   p j v = n e w   d o u b l e [ 1 6 ] ; 
 
 	 	 	 	         f o r ( i n t   i = 0 ; i < 1 2 ; i + + ) { 
 
 	 	 	 	 	         p j v [ i ] = b i s . g e t D o u b l e ( ) ; 
 
 	 	 	 	         } 	 	 	 
 
 	 	 	 	         p j v [ 1 2 ] = p j v [ 1 3 ] = p j v [ 1 4 ] = 0 ; 
 
 	 	 	 	         p j v [ 1 5 ] = 1 ; 
 
 	 	 	 	         t h i s . p m a t . s e t V a l u e ( p j v ) ; 
 
         	 	 	 	 
 
 	 	 	 	         / / d i s t   f a c t o r 
 
 	 	 	 	         d o u b l e [ ]   d f ; 
 
 	 	 	 	         s w i t c h ( v e r s i o n ) 
 
 	 	 	 	         { 
 
 	 	 	 	         c a s e   1 : / / V e r s i o n 1 
 
 	 	 	 	 	         d f = n e w   d o u b l e [ N y A R C a m e r a D i s t o r t i o n F a c t o r V 2 . N U M _ O F _ F A C T O R ] ; 
 
 	 	 	 	 	         t h i s . d i s t _ f a c t o r = n e w   N y A R C a m e r a D i s t o r t i o n F a c t o r V 2 ( ) ; 
 
 	 	 	 	 	         b r e a k ; 
 
 	 	 	 	         c a s e   4 : / / V e r s i o n 4 
 
 	 	 	 	 	         d f = n e w   d o u b l e [ N y A R C a m e r a D i s t o r t i o n F a c t o r V 4 . N U M _ O F _ F A C T O R ] ; 
 
 	 	 	 	 	         t h i s . d i s t _ f a c t o r = n e w   N y A R C a m e r a D i s t o r t i o n F a c t o r V 4 ( ) ; 
 
 	 	 	 	 	         b r e a k ; 
 
 	 	 	 	         d e f a u l t : 
 
 	 	 	 	 	         t h r o w   n e w   N y A R E x c e p t i o n ( ) ; 
 
 	 	 	 	         } 
 
 	 	 	 	         f o r ( i n t   i = 0 ; i < d f . L e n g t h ; i + + ) { 
 
 	 	 	 	 	         d f [ i ] = b i s . g e t D o u b l e ( ) ; 
 
 	 	 	 	         } 
 
 	 	 	 	         t h i s . d i s t _ f a c t o r . s e t V a l u e ( d f ) ; 
 
 	 	 	         }   c a t c h   ( E x c e p t i o n   e )   { 
 
 	 	 	 	         t h r o w   n e w   N y A R E x c e p t i o n ( e ) ; 
 
 	 	 	         } 	 	 	 
 
 	 	         } 
 
 	         } 
 
                 / * * 
 
                   *   S0n0peo0_jW0~0[000
 
                   *   @ p a r a m   i _ s t r e a m 
 
                   *   *g[
 
                   *   @ t h r o w s   E x c e p t i o n 
 
                   * / 
 
                 p u b l i c   v o i d   s a v e A R P a r a m ( S t r e a m W r i t e r   i _ s t r e a m ) 
 
                 { 
 
                         N y A R E x c e p t i o n . t r a p ( " *g0000n0pe" ) ; 
 
                 } 
 
         } 
 
 } 
 
 