SliceO_Frame::Inf_2_Frm

 

This method enable you to convert coordinates in "Inf" space to coordinates in "Frm" space.

 

 

Syntax

 

Point_2D  Inf_2_Frm(

          SliceO_Window * window,

          Point_2D pos_inf

) ;

 

Region_2D  Inf_2_Frm(

          SliceO_Window * window,

          Region_2D reg_inf

) ;

 

 

Parameters

 

window

          Pointer to the window used for the conversion.

 

pos_inf

          2D point to convert from "Inf" space to "Frm" space.

 

reg_inf

          2D region to convert from "Inf" space to "Frm" space.

 

 

Return value

 

This method return either a transformed 2D point or a 2D region depending on its arguments.

 

 

Remarks

 

The transformation is computed by:

·Subtracting the origin of the frame in "Inf" space to the coordinates.

·Scaling each coordinates by the current scaling factor for the desired window.

·Scaling the "y" coordinate by the pixel aspect ratio.

 

 

// ----------------------------------------------------------------------------

//

//          Inf_2_Frm()

//

//          param:          window (SliceO_Window *)    the curent window

//                    pos_inf (Point_2D)          The position in "Inf" space

//

//          return:          (Point_2D)                    new coord in "Frm" space

//

// ----------------------------------------------------------------------------

Point_2D          SliceO_Frame::Inf_2_Frm( SliceO_Window *window, Point_2D pos_inf )

{

          Region_2D reg_inf = Inside_Get( window ) ;

 

          float x = pos_inf[0] ;

          float y = pos_inf[1] ;

 

          x -= reg_inf[0] ;

          y -= reg_inf[1] ;

 

          x /= m_scale[window->Id_Get()][window->Mode_Get()] ;

          y /= m_scale[window->Id_Get()][window->Mode_Get()] * m_ratio ;

 

          Point_2D pos_frm( COORD_FRM ) ;

 

          pos_frm.Set( x, y ) ;

 

          return( pos_frm ) ;

}

 

Requirements

 

Header:

          sliceO_include.hpp

 

Library:

          sliceO_Structures.lib

 

 

Example

 

 

 

See also

 

The Coordinate Systems