// ----------------------------------------------------------------------
   void
   XYZFileElevationTask::
   xy_place_scale( shawn::SimulationController& sc,
                 const XYZFile& f,
                 shawn::Vec& bp, shawn::Vec& s )
      throw( std::runtime_error )
   {
      double scale = sc.environment().optional_double_param("xy_scale",1.0);

      bp = Vec( sc.environment().optional_double_param("x1",0.0),
                sc.environment().optional_double_param("y1",0.0),
                bp.z() );
      s = Vec( sc.environment().optional_double_param("x_scale",scale),
               sc.environment().optional_double_param("y_scale",scale),
               s.z() );
   }
Exemplo n.º 2
0
   // ----------------------------------------------------------------------
   void
   rotate_2D( double angle, shawn::Vec& coord, const shawn::Vec& origin )
      throw()
   {
      double cos_angle = cos( angle );
      double sin_angle = sin( angle );

      coord = shawn::Vec(
         ((coord.x() - origin.x()) * cos_angle) - ((coord.y() - origin.y()) * sin_angle) + origin.x(),
         ((coord.y() - origin.y()) * cos_angle) + ((coord.x() - origin.x()) * sin_angle) + origin.y(),
         coord.z() );
   }