Ejemplo n.º 1
0
    CubeGeoFence(const Vector3r& point_min, const Vector3r& point_max, float distance_accuracy)
        : point_min_(point_min), point_max_(point_max), distance_accuracy_(distance_accuracy)
    {
        calculateCenter();

        Utils::logMessage("CubeGeoFence: %s", toString().c_str());
    }
Ejemplo n.º 2
0
void PolygonItem::setPoints(const QVector<QPointF> & points)
{
	if (_points != points) {
		_points = points;
		_center = calculateCenter(points);
		emit pointsChanged();
	}
}
Ejemplo n.º 3
0
	void GOAPapp::initInput() {
		//control
		auto mouse = new Mouse();
		auto window_hwnd = m_pRenderer->getWindow()->getHWND();
		mouse->init(window_hwnd);
		mouse->calculateCenter(window_hwnd);

		new KeyBoard();
	}
Ejemplo n.º 4
0
Face :: Face()
{
    vertexVector.push_back( new Vertex(0.0, 0.0, 0.0) );
    vertexVector.push_back( new Vertex(1.0, 0.0, 0.0) );
    vertexVector.push_back( new Vertex(0.0, 1.0, 0.0) );

    normal.set_xyz(0.0, 0.0, 1.0);
    center = calculateCenter();
}
Ejemplo n.º 5
0
Face :: Face(Vertex* v1, Vertex* v2, Vertex* v3)
{
    vertexVector.push_back(v1);
    vertexVector.push_back(v2);
    vertexVector.push_back(v3);

    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 6
0
void Face :: setVertices(Vertex* v1, Vertex* v2, Vertex* v3)
{
    vertexVector[0] = v1;
    vertexVector[1] = v2;
    vertexVector[2] = v3;

    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 7
0
void PointGroup::removePoint(GPoint _point) {
    for (int i = 0; i < mPoints.size(); i++)
    {
        if (mPoints[i].getStrokeId() == _point.getStrokeId()) {
            mPoints.erase(mPoints.begin()+i);
            break;
        }
    }
    //center neu berechnen
    calculateCenter();
}
Ejemplo n.º 8
0
   void BoxMesh::construct() 
   {
      int   i ;
      Box   bounds = getBounds() ;
      Point center = (bounds.max - bounds.min) / 2 ;

      // Vertex
      verts.push_back(Point(bounds.min.x(), bounds.min.y(), bounds.min.z()));
      verts.push_back(Point(bounds.max.x(), bounds.min.y(), bounds.min.z()));
      verts.push_back(Point(bounds.min.x(), bounds.max.y(), bounds.min.z()));
      verts.push_back(Point(bounds.max.x(), bounds.max.y(), bounds.min.z()));
      verts.push_back(Point(bounds.min.x(), bounds.min.y(), bounds.max.z()));
      verts.push_back(Point(bounds.max.x(), bounds.min.y(), bounds.max.z()));
      verts.push_back(Point(bounds.min.x(), bounds.max.y(), bounds.max.z()));
      verts.push_back(Point(bounds.max.x(), bounds.max.y(), bounds.max.z()));

      // Texture coordinates
      for (i = 0 ; i < 8 ; i++)
         tverts.push_back(Point2D(0,0));

      // Indices
      int inds[] = { 0, 4, 1, 5, 3, 7, 2, 6, 0, 4, 6, 7, 4, 5, 0, 1, 2, 3 } ;
      for (i = 0 ; i < sizeof(inds)/sizeof(inds[0]) ; i++)
         indices.push_back(inds[i]);

      // Primitives
      Primitive p ;
      p.firstElement = 0 ;
      p.numElements  = 10 ;
      p.type         = Primitive::NoMaterial | Primitive::Strip | Primitive::Indexed ;
      primitives.push_back(p) ;
      p.firstElement = 10 ;
      p.numElements  = 4 ;
      primitives.push_back(p) ;
      p.firstElement = 14 ;
      primitives.push_back(p) ;

      // Normals
      std::vector<Point>::iterator ptr ;
      for (ptr = verts.begin() ; ptr != verts.end() ; ptr++)
      {
         Point normal ;
         normal = *ptr - center ;
         normal.normalize() ;
         normals.push_back (normal) ;
         enormals.push_back (encodeNormal(normal)) ;
      }

      // Other stuff
      setFrames (1) ;
      setParent (-1) ;
      calculateCenter() ;
      calculateRadius() ;
   }
Ejemplo n.º 9
0
    void setBoundry(const Vector3r& origin, float xy_length, float max_z, float min_z) override
    {
        point_min_ = Vector3r(-xy_length, -xy_length, 0) + origin;
        point_min_[2] = max_z;

        point_max_ = Vector3r(xy_length, xy_length, 0) + origin;
        point_max_[2] = min_z;  

        calculateCenter();

        Utils::logMessage("CubeGeoFence: %s", toString().c_str());
    }
Ejemplo n.º 10
0
Flag::Flag(const sf::Vector2f& spawnLocation, const sf::Color& flagColor):
    flag(),
    spawnPosition(spawnLocation),
    beingHeld(false),
    atSpawn(true),
    floor(OVERGROUND_FLOOR)
    {
        flag.setRadius(20);
        flag.setOrigin(calculateCenter(flag.getLocalBounds()));
        flag.setPosition(spawnPosition);
        flag.setFillColor(flagColor);
    }
Ejemplo n.º 11
0
// Сглаживание контуров, исключение артефактов.
int smoothContour(frGeomStrip* src){
	
	if ( src->edgeA.size() != src->edgeB.size() ){
		return 0;
	}
	// сгладить
	applySmooth(src);

	// отрезать ролики
	if( vertical )
		applyDisRoller(src);

	// перестроить центральную линию
	calculateCenter(src);

	
	return 0;
}
Ejemplo n.º 12
0
void Face :: setVertexV2(Vertex* v2)
{
    vertexVector[1] = v2;
    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 13
0
void Face :: setVertexV1(Vertex* v1)
{
    vertexVector[0] = v1;
    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 14
0
Bezier::Bezier(VertexManager *vertexManager) : Model()
{
	this->m_vertexManager->append(vertexManager);
	calculateCenter();
}
Ejemplo n.º 15
0
   void CylinderMesh::construct()
   {
      int i, firstTop ;
      int steps = (unsigned int)(complexity * 64.0f) ;
      float angle ;
      Point normal ;
      Box   bounds = getBounds() ;
      Point center = getCenter() ;
      float radius = getRadius() ;

      Primitive p ;
      p.type = Primitive::NoMaterial | Primitive::Strip | Primitive::Indexed ;

      if (steps < 4)  steps = 4 ;
      if (steps > 64) steps = 64 ;
      steps &= ~1 ;

      // Bottom
      addVertex (center.x(), center.y(), bounds.min.z()) ;
      for (angle = 0.0f, i = 0 ; i < steps ; i++, angle += 2.0f*M_PI/(float)steps)
      {
         addVertex (cosf(angle)*radius + center.x(), sinf(angle)*radius + center.y(), 
                    bounds.min.z()) ;
      }

      for (i = 1 ; i <= steps ; i++)
      {
         p.firstElement = indices.size() ;
         p.numElements  = 3 ;
         indices.push_back (0) ;
         indices.push_back (i) ;
         indices.push_back (i == steps ? 1 : i+1) ;
         primitives.push_back(p) ;
      }

      // Top
      firstTop = verts.size() ;
      addVertex (center.x(), center.y(), bounds.max.z()) ;
      for (angle = 0.0f, i = 0 ; i < steps ; i++, angle += 2.0f*M_PI/(float)steps)
      {
         addVertex (cosf(angle)*radius + center.x(), sinf(angle)*radius + center.y(), 
                    bounds.max.z()) ;
      }

      for (i = 1 ; i <= steps ; i++)
      {
         p.firstElement = indices.size() ;
         p.numElements  = 3 ;
         indices.push_back (firstTop) ;
         indices.push_back (firstTop+(i == steps ? 1 : i+1)) ;
         indices.push_back (firstTop+i) ;
         primitives.push_back(p) ;
      }

      // Walls
      int pos ;
      for (pos = indices.size(), i = 0 ; i < steps-1 ; i++, pos += 4)
      {
         indices.push_back (i+1) ;
         indices.push_back (firstTop+i+1) ;
         indices.push_back (i+2) ;
         indices.push_back (firstTop+i+2) ;
         p.firstElement = pos ;
         p.numElements  = 4 ;
         primitives.push_back(p) ;
      }
      indices.push_back (i+1) ;
      indices.push_back (firstTop+i+1) ;
      indices.push_back (1) ;
      indices.push_back (firstTop+1) ;
      p.firstElement = pos ;
      p.numElements  = 4 ;
      primitives.push_back(p) ;

      // Other stuff

      setFrames (1) ;
      setParent (-1) ;
      calculateBounds() ;
      calculateCenter() ;
      calculateRadius() ;
   }
Ejemplo n.º 16
0
void Node::addPoints(vector<vec3> _points) 
{ 
	points = _points; 
	calculateCenter();
}
Ejemplo n.º 17
0
void Face :: setVertexV3(Vertex* v3)
{
    vertexVector[2] = v3;
    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 18
0
void Face :: setVertexV4(Vertex* v4)
{
    vertexVector[3] = v4;
    normal = calculateNormal();
    center = calculateCenter();
}
Ejemplo n.º 19
0
//----------------------------------
void PointGroup::addPoint(GPoint _point) {
    mPoints.push_back(_point);
    calculateCenter();
}
Ejemplo n.º 20
0
VortexTubeVorticityDistribution::VortexTubeVorticityDistribution(const glm::dvec3 &center, double radius, double variation, double width, int periods, int location)
	: VorticityDistribution{ calculateCenter(center, location, radius) }, m_Radius{ radius }, m_Variation{ variation }, m_Width{ width },
	m_Wavenumber{ static_cast<double>(periods) }, m_Location{ location }
{
	m_DomainSize = calculateDomainSize();
}
Ejemplo n.º 21
0
void Node::addPoint(vec3 point) 
{ 
	points.push_back(point); 
	calculateCenter();
}