示例#1
0
Util::Vector SteerLib::GJK_EPA::central_origin_of_shape(const std::vector<Util::Vector>& shape) {
    
    Util::Vector the_shapes_center (0, 0, 0);
    Util::Vector central_location  (0, 0, 0);
    Util::Vector temporary_vector  (0, 0, 0);
    
    float shapeSize = shape.size();
    int count = 0;
    
    float xvalue = 0;
    float zvalue = 0;
    
    while(count < shapeSize)
    {
        central_location = shape[count];
        
        xvalue = central_location[0];
        zvalue = central_location[2];
        
        the_shapes_center [0] = the_shapes_center [0] + xvalue;
        the_shapes_center [2] = the_shapes_center [2] + xvalue;
        
       temporary_vector [0] = the_shapes_center [0] / shapeSize;
       temporary_vector [2] = the_shapes_center [2] / shapeSize;
        
     
        count++;
    }
    
    the_shapes_center = temporary_vector;
    
    return the_shapes_center;
}
示例#2
0
 static inline void push_back(Ring& ring, Point const& point)
 {
     // Boost.Polygon's polygons are not appendable. So create a temporary vector,
     // add a record and set it to the original. Of course: this is not efficient.
     // But there seems no other way (without using a wrapper)
     std::vector<Point> temporary_vector
         (
             boost::polygon::begin_points(ring),
             boost::polygon::end_points(ring)
         );
     temporary_vector.push_back(point);
     boost::polygon::set_points(ring, temporary_vector.begin(), temporary_vector.end());
 }
示例#3
0
文件: ring.hpp 项目: AsherBond/PDAL
 static inline void apply(pdalboost::polygon::polygon_data<CoordinateType>& data,
      point_type const& point)
 {
     // Boost.Polygon's polygons are not appendable. So create a temporary vector,
     // add a record and set it to the original. Of course: this is not efficient.
     // But there seems no other way (without using a wrapper)
     std::vector<point_type> temporary_vector
         (
             pdalboost::polygon::begin_points(data),
             pdalboost::polygon::end_points(data)
         );
     temporary_vector.push_back(point);
     data.set(temporary_vector.begin(), temporary_vector.end());
 }
示例#4
0
void UpdateCamera()
{



    float tempX = ActualCharacter->Position.x * ActualMap->TileSize.x; //
    float tempY = ActualCharacter->Position.y * ActualMap->TileSize.y;
    sf::Vector2f temporary_vector(Camera.getCenter()); /** PRZY FULL SCREENIE SIE JEBIE **/

    float MapSizeX = ActualMap->graphic.getSize().x;
    float MapSizeY = ActualMap->graphic.getSize().y;

    float ScreenWidth = GameWindow->getSize().x;
    float ScreenHeight = GameWindow->getSize().y;


    if(tempX >= ScreenWidth/2 && MapSizeX > tempX + ScreenWidth/2)
        temporary_vector.x = tempX;
    else
    {
        if(MapSizeX >= ScreenWidth)
        {

            if(tempX < ScreenWidth/2)
                temporary_vector.x = ScreenWidth/2;
            if(MapSizeX <= tempX + ScreenWidth/2)
                temporary_vector.x = MapSizeX - ScreenWidth/2;
        }
    }

    if(tempY >= ScreenHeight/2 && MapSizeY > tempY + ScreenHeight/2)
        temporary_vector.y = tempY;
    else
    {
        if(MapSizeY >= ScreenHeight)
        {

            if(tempY < ScreenHeight/2)
                temporary_vector.y = ScreenHeight/2;
            if(MapSizeY<= tempY + ScreenHeight/2)
                temporary_vector.y = MapSizeY - ScreenHeight/2;
        }

    }
    Camera.setCenter(temporary_vector);
    GameWindow->setView(Camera);


}