u s i n g   U n i t y E n g i n e ; 
 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 ; 
 u s i n g   N y A R U n i t y U t i l s ; 
 u s i n g   j p . n y a t l a . n y a r t o o l k i t . c s . m a r k e r s y s t e m ; 
 u s i n g   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 ; 
 
 n a m e s p a c e   N y A R U n i t y U t i l s 
 { 
 	 p u b l i c   c l a s s   N y A R U n i t y M a r k e r S y s t e m : N y A R M a r k e r S y s t e m 
 	 { 
 	 	 p u b l i c   N y A R U n i t y M a r k e r S y s t e m ( I N y A R M a r k e r S y s t e m C o n f i g   i _ c o n f i g ) : b a s e ( i _ c o n f i g ) 
 	 	 { 
 	 	 } 
 	 	 p r o t e c t e d   o v e r r i d e   v o i d   i n i t I n s t a n c e ( I N y A R M a r k e r S y s t e m C o n f i g   i _ c o n f i g ) 
 	 	 { 
 	 	 	 b a s e . i n i t I n s t a n c e ( i _ c o n f i g ) ; 	 	 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   T h i s   f u n c t i o n   r e t u r n s   O p e n G L   s t y l e   p r o j e c t i o n   m a t r i x   t o   o u t p u t   p a r a m e t e r . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < r e t u r n s > 
 	 	 / / /   o u t p u t   p a r a m e t o r . 
 	 	 / / /   < / r e t u r n s > 
 	 	 / / /   < p a r a m   n a m e = ' i _ m a t ' > 
 	 	 / / /   i _ m a t   o b j e c t   w h i c h   c o n t a i n   p r o j e c t i o n   m a t r i x . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   M a t r i x 4 x 4   g e t U n i t y P r o j e c t i o n M a t r i x ( r e f   M a t r i x 4 x 4   i _ m a t ) 
 	 	 { 
 	 	 	 N y A R F r u s t u m . F r u s t u m P a r a m   f = t h i s . g e t F r u s t u m ( ) . g e t F r u s t u m P a r a m ( n e w   N y A R F r u s t u m . F r u s t u m P a r a m ( ) ) ; 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a F r u s t u m R H ( t h i s . _ r e f _ p a r a m , 1 , f . n e a r , f . f a r , r e f   i _ m a t ) ; 
 	 	 	 r e t u r n   i _ m a t ; 
 	 	 } 	 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   T h i s   f u n c t i o n   r e t u r n s   O p e n G L   s t y l e   p r o j e c t i o n   m a t r i x . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < r e t u r n s > 
 	 	 / / /   o u t p u t   p a r a m e t o r . 
 	 	 / / /   < / r e t u r n s > 
 	 	 p u b l i c   M a t r i x 4 x 4   g e t U n i t y P r o j e c t i o n M a t r i x ( ) 
 	 	 { 
 	 	 	 M a t r i x 4 x 4   m a t = n e w   M a t r i x 4 x 4 ( ) ; 
 	 	 	 N y A R F r u s t u m . F r u s t u m P a r a m   f = t h i s . g e t F r u s t u m ( ) . g e t F r u s t u m P a r a m ( n e w   N y A R F r u s t u m . F r u s t u m P a r a m ( ) ) ; 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a F r u s t u m R H ( t h i s . _ r e f _ p a r a m , 1 , f . n e a r , f . f a r , r e f   m a t ) ; 
 	 	 	 r e t u r n   m a t ; 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   G e t s   t h e   U n i t y   f o r m   m a r k e r   m a t r i x . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < r e t u r n s > 
 	 	 / / /   T h e   m a r k e r   m a t r i x . 
 	 	 / / /   < / r e t u r n s > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i d ' > 
 	 	 / / /   I _ i d . 
 	 	 / / /   < / p a r a m > 
 	 	 / / /   < p a r a m   n a m e = ' i _ b u f ' > 
 	 	 / / /   I _ b u f . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   v o i d   g e t M a r k e r M a t r i x ( i n t   i _ i d , r e f   M a t r i x 4 x 4   i _ b u f ) 
 	 	 { 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a V i e w R H ( b a s e . g e t M a r k e r M a t r i x ( i _ i d ) , 1 , r e f   i _ b u f ) ; 
 	 	 } 
 	 	 
 	 	 p u b l i c   M a t r i x 4 x 4   g e t U n i t y M a r k e r M a t r i x ( i n t   i _ i d ) 
 	 	 { 
 	 	 	 M a t r i x 4 x 4   b u f = n e w   M a t r i x 4 x 4 ( ) ; 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a V i e w R H ( b a s e . g e t M a r k e r M a t r i x ( i _ i d ) , 1 , r e f   b u f ) ; 
 	 	 	 r e t u r n   b u f ; 
 	 	 } 
 
 	 	 p u b l i c   v o i d   g e t M a r k e r P l a n e P o s ( i n t   i d , i n t   i _ x , i n t   i _ y , r e f   V e c t o r 3   i _ o u t ) 
 	 	 { 
 	 	 	 N y A R D o u b l e P o i n t 3 d   p = n e w   N y A R D o u b l e P o i n t 3 d ( ) ; 
 	 	 	 t h i s . g e t M a r k e r P l a n e P o s ( i d , i _ x , i _ y , p ) ; 
 	 	 	 i _ o u t . x = - ( f l o a t ) p . x ; 
 	 	 	 i _ o u t . y = ( f l o a t ) p . y ; 
 	 	 	 i _ o u t . z = ( f l o a t ) p . z ; 
 	 	 } 
 	 	 
 	 	 
                 / / /   < s u m m a r y > 
                 / / /   { @ l i n k   # a d d A R M a r k e r ( I N y A R R g b R a s t e r ,   i n t ,   i n t ,   d o u b l e ) } n00000g0Y00B i t m a p K0000000000\O0~0Y00
                 / / /   _pek0d0D0f0o00{ @ l i n k   # a d d A R M a r k e r ( I N y A R R g b R a s t e r ,   i n t ,   i n t ,   d o u b l e ) } 0SgqW0f0O0`0U0D00
                 / / /   
                 / / /   < / s u m m a r y > 
                 / / /   < p a r a m   n a m e = " i _ i m g " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ p a t t _ r e s o l u t i o n " > ubY00000n0P^0c[W0~0Y00< / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ p a t t _ e d g e _ p e r c e n t a g e " > ;uPn0000W0% g0c[W0~0Y00< / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ m a r k e r _ s i z e " > 000n0irt0000c[W0~0Y00< / p a r a m > 
                 / / /   < r e t u r n s > < / r e t u r n s > 
                 p u b l i c   i n t   a d d A R M a r k e r ( T e x t u r e 2 D   i _ i m g ,   i n t   i _ p a t t _ r e s o l u t i o n ,   i n t   i _ p a t t _ e d g e _ p e r c e n t a g e ,   d o u b l e   i _ m a r k e r _ s i z e ) 
                 { 
                         i n t   w   =   i _ i m g . w i d t h ; 
                         i n t   h   =   i _ i m g . h e i g h t ; 
                         N y A R U n i t y R a s t e r   u r   =   n e w   N y A R U n i t y R a s t e r ( i _ i m g ) ; 
 	 	 	 N y A R C o d e   c   =   n e w   N y A R C o d e ( i _ p a t t _ r e s o l u t i o n ,   i _ p a t t _ r e s o l u t i o n ) ; 
                         / / 000K0000000000R0QY0
                         I N y A R P e r s p e c t i v e C o p y   p c   =   ( I N y A R P e r s p e c t i v e C o p y ) u r . c r e a t e I n t e r f a c e ( t y p e o f ( I N y A R P e r s p e c t i v e C o p y ) ) ; 
                         N y A R R g b R a s t e r   t r   =   n e w   N y A R R g b R a s t e r ( i _ p a t t _ r e s o l u t i o n ,   i _ p a t t _ r e s o l u t i o n ) ; 
                         p c . c o p y P a t t ( 0 ,   0 ,   w ,   0 ,   w ,   h ,   0 ,   h ,   i _ p a t t _ e d g e _ p e r c e n t a g e ,   i _ p a t t _ e d g e _ p e r c e n t a g e ,   4 ,   t r ) ; 
                         / / R0QW0_000000000
                         c . s e t R a s t e r ( t r ) ; 
                         r e t u r n   b a s e . a d d A R M a r k e r ( c ,   i _ p a t t _ e d g e _ p e r c e n t a g e ,   i _ m a r k e r _ s i z e ) ; 
                 } 
                 / / /   < s u m m a r y > 
                 / / /   S0n0peo00{ @ l i n k   # g e t M a r k e r P l a n e I m a g e ( i n t ,   N y A R S e n s o r ,   i n t ,   i n t ,   i n t ,   i n t ,   i n t ,   i n t ,   i n t ,   i n t ,   I N y A R R g b R a s t e r ) } 
                 / / /   n00000g0Y00S_;uP0{ @ l i n k   # B u f f e r e d I m a g e } b__g0ԏW0~0Y00
                 / / /   < / s u m m a r y > 
                 / / /   < p a r a m   n a m e = " i _ i d " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ s e n s o r " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ x 1 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ y 1 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ x 2 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ y 2 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ x 3 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ y 3 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ x 4 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ y 4 " > < / p a r a m > 
                 / / /   < p a r a m   n a m e = " i _ i m g " > < / p a r a m > 
                 / / /   < r e t u r n s > < / r e t u r n s > 
 
                 p u b l i c   v o i d   g e t M a r k e r P l a n e I m a g e ( 
                         i n t   i _ i d , 
                         N y A R S e n s o r   i _ s e n s o r , 
                         i n t   i _ x 1 ,   i n t   i _ y 1 , 
                         i n t   i _ x 2 ,   i n t   i _ y 2 , 
                         i n t   i _ x 3 ,   i n t   i _ y 3 , 
                         i n t   i _ x 4 ,   i n t   i _ y 4 , 
                         T e x t u r e 2 D   i _ i m g ) 
                 { 
                         N y A R U n i t y R a s t e r   b m r   =   n e w   N y A R U n i t y R a s t e r ( i _ i m g ) ; 
                         b a s e . g e t M a r k e r P l a n e I m a g e ( i _ i d ,   i _ s e n s o r ,   i _ x 1 ,   i _ y 1 ,   i _ x 2 ,   i _ y 2 ,   i _ x 3 ,   i _ y 3 ,   i _ x 4 ,   i _ y 4 ,   b m r ) ; 
                         r e t u r n ; 
                 } 
                 / * * 
                   *   S0n0peo00{ @ l i n k   # g e t M a r k e r P l a n e I m a g e ( i n t ,   N y A R S e n s o r ,   i n t ,   i n t ,   i n t ,   i n t ,   I N y A R R g b R a s t e r ) } 
                   *   n00000g0Y00S_;uP0{ @ l i n k   # B u f f e r e d I m a g e } b__g0ԏW0~0Y00
                   *   @ p a r a m   i _ i d 
                   *   000i d 
                   *   @ p a r a m   i _ s e n s o r 
                   *   ;uP0S_Y0000000000008^o0{ @ l i n k   # u p d a t e ( N y A R S e n s o r ) } pek0eQRW0_00n0h0TX00n00c[W0~0Y00
                   *   @ p a r a m   i _ l 
                   *   @ p a r a m   i _ t 
                   *   @ p a r a m   i _ w 
                   *   @ p a r a m   i _ h 
                   *   @ p a r a m   i _ r a s t e r 
                   *   QRHQn0000000
                   *   @ r e t u r n 
                   *   P}g0<h
}W0_0i _ r a s t e r 000000
                   *   @ 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   v o i d   g e t M a r k e r P l a n e I m a g e ( 
                         i n t   i _ i d , 
                         N y A R S e n s o r   i _ s e n s o r , 
                         i n t   i _ l ,   i n t   i _ t , 
                         i n t   i _ w ,   i n t   i _ h , 
                         T e x t u r e 2 D   i _ i m g ) 
                 { 
                         N y A R U n i t y R a s t e r   b m r   =   n e w   N y A R U n i t y R a s t e r ( i _ i m g . w i d t h , i _ i m g . h e i g h t , t r u e ) ; 
                         b a s e . g e t M a r k e r P l a n e I m a g e ( i _ i d ,   i _ s e n s o r ,   i _ l ,   i _ t ,   i _ w ,   i _ h ,   b m r ) ; 
 	 	 	 i _ i m g . S e t P i x e l s 3 2 ( ( C o l o r 3 2 [ ] ) b m r . g e t B u f f e r ( ) ) ; 
 	 	 	 i _ i m g . A p p l y ( ) ; 
 	 	 	 
                         r e t u r n ; 
                 } 	 	 
 	 	 
 	 	 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   S0n0peo0, c a m e r a 000000k0P r o j e c t i o n M a t r i x 0c[W0~0Y0. 
 	 	 / / /   < / s u m m a r y > 
 	 	 p u b l i c   v o i d   s e t A R C a m e r a P r o j e c t i o n ( C a m e r a   i _ c a m e r a ) 
 	 	 { 
 	 	 	 N y A R F r u s t u m   f = t h i s . g e t F r u s t u m ( ) ; 
 	 	 	 N y A R F r u s t u m . P e r s p e c t i v e P a r a m   p p = f . g e t P e r s p e c t i v e P a r a m ( n e w   N y A R F r u s t u m . P e r s p e c t i v e P a r a m ( ) ) ; 
 	 	 	 / / s e t u p   c a m e r a   p r o j e c t i o n 
 	 	 	 i _ c a m e r a . n e a r C l i p P l a n e = ( f l o a t ) p p . n e a r ; 
 	 	 	 i _ c a m e r a . f a r C l i p P l a n e = ( f l o a t ) p p . f a r ; 
 	 	 	 i _ c a m e r a . f i e l d O f V i e w = ( f l o a t ) ( 3 6 0 * p p . f o v y / ( 2 * M a t h . P I ) ) ; 
 	 	 	 i _ c a m e r a . a s p e c t = ( f l o a t ) ( p p . a s p e c t ) ; 
 	 	 	 i _ c a m e r a . t r a n s f o r m . L o o k A t ( n e w   V e c t o r 3 ( 0 , 0 , 0 ) , n e w   V e c t o r 3 ( 1 , 0 , 0 ) ) ; 
 	 	 } 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   S0n0peo0, ̀of;uPn0YRLR0t r a n s f o r m 000k0-[W0~0Y0. 
 	 	 / / /   < / s u m m a r y > 
 	 	 p u b l i c   v o i d   s e t A R B a c k g r o u n d T r a n s f o r m ( T r a n s f o r m   i _ t r a n s f o r m ) 
 	 	 { 
 	 	 	 N y A R F r u s t u m   f = t h i s . g e t F r u s t u m ( ) ; 
 	 	 	 N y A R F r u s t u m . F r u s t u m P a r a m   f p = f . g e t F r u s t u m P a r a m ( n e w   N y A R F r u s t u m . F r u s t u m P a r a m ( ) ) ; 
 	 	 	 f l o a t   b g _ p o s = ( f l o a t ) f p . f a r ; 
 	 	 	 i _ t r a n s f o r m . p o s i t i o n = n e w   V e c t o r 3 ( 0 , 0 , ( f l o a t ) b g _ p o s ) ; 
 	 	 	 d o u b l e   b = b g _ p o s / f p . n e a r / 1 0 ; / /   1 0 ? 
 	 	 	 i _ t r a n s f o r m . l o c a l S c a l e = n e w   V e c t o r 3 ( ( f l o a t ) ( - ( f p . r i g h t - f p . l e f t ) * b ) , 1 f , - ( f l o a t ) ( ( f p . t o p - f p . b o t t o m ) * b ) ) ; 
 	 	 	 i _ t r a n s f o r m . e u l e r A n g l e s = n e w   V e c t o r 3 ( - 9 0 , 0 , 0 ) ; 
 	 	 } 
 	 	 
 	 	 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   G e t s   t h e   u n i t y   m a r k e r   t r a n s f o r m   r o t a t i o n   a n d   p o s i t i o n . 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i d ' > 
 	 	 / / /   I _ i d . 
 	 	 / / /   < / p a r a m > 
 	 	 / / /   < p a r a m   n a m e = ' o _ p o s ' > 
 	 	 / / /   O _ p o s . 
 	 	 / / /   < / p a r a m > 
 	 	 / / /   < p a r a m   n a m e = ' o _ r o t a t i o n ' > 
 	 	 / / /   O _ r o t a t i o n . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   v o i d   g e t M a r k e r T r a n s f o r m ( i n t   i _ i d , r e f   V e c t o r 3   o _ p o s , r e f   Q u a t e r n i o n   o _ r o t a t i o n ) 
 	 	 { 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a V i e w R H ( t h i s . g e t M a r k e r M a t r i x ( i _ i d ) , 1 , r e f   o _ p o s , r e f   o _ r o t a t i o n ) ; 
 	 	 } 
 	 	 
 	 	 / / /   < s u m m a r y > 
 	 	 / / /   S e t s   m a r k e r   m a t r i x   t o   u n i t y   t r a n s f o r m 
 	 	 / / /   < / s u m m a r y > 
 	 	 / / /   < p a r a m   n a m e = ' i _ i d ' > 
 	 	 / / /   I _ i d . 
 	 	 / / /   < / p a r a m > 
 	 	 / / /   < p a r a m   n a m e = ' i _ t ' > 
 	 	 / / /   I _ t . 
 	 	 / / /   < / p a r a m > 
 	 	 p u b l i c   v o i d   s e t M a r k e r T r a n s f o r m ( i n t   i _ i d , T r a n s f o r m   i _ t ) 
 	 	 { 
 	 	 	 V e c t o r 3   p = n e w   V e c t o r 3 ( ) ; 
 	 	 	 Q u a t e r n i o n   r = n e w   Q u a t e r n i o n ( ) ; 
 	 	 	 N y A R U n i t y U t i l . t o C a m e r a V i e w R H ( t h i s . g e t M a r k e r M a t r i x ( i _ i d ) , 1 , r e f   p , r e f   r ) ; 
 	 	 	 i _ t . l o c a l P o s i t i o n = p ; 
 	 	 	 i _ t . l o c a l R o t a t i o n = r ; 
 	 	 } 	 	 
 	 	 p u b l i c   v o i d   s e t M a r k e r T r a n s f o r m ( i n t   i _ i d , G a m e O b j e c t   i _ g o ) 
 	 	 { 
 	 	 	 t h i s . s e t M a r k e r T r a n s f o r m ( i _ i d , i _ g o . t r a n s f o r m ) ; 
 	 	 } 
 	 } 
 } 
 
 