Exemplo n.º 1
0
void ENUTracker::reset(const Vector3& pos) {
	quickCounter = 2500;
#ifndef USE_SINGLE__PRECISION_NUMBERS
	setOrigin(pos.x);
#else
	double x[3];  
	x[0] = pos[0];  x[1] = pos[1];  x[2] = pos[2];
	setOrigin(x);
#endif
	lastPosition = pos;
}
/*!
    \property QGeoMapPolygonObject::path
    \brief This property holds the ordered list of coordinates which define the
    polygon to be drawn by this polygon object.

    The default value of this property is an empty list of coordinates.

    The coordinates should be listed in the order in which they would be
    traversed when traveling around the border of the polygon.

    Invalid coordinates in the list will be ignored, and if the list of
    coordinates contains less than 3 valid coordinates then the polygon object
    will not be displayed.

    \since 1.1
*/
void QGeoMapPolygonObject::setPath(const QList<QGeoCoordinate> &path)
{
    if (d_ptr->path != path) {
        d_ptr->path = path;
        if (path.size() != 0)
            setOrigin(path.at(0));
        else
            setOrigin(QGeoCoordinate());
        emit pathChanged(emit d_ptr->path);
    }
}
/*!
    Constructs a new pixmap object which will draw the pixmap \a pixmap at an
    offset of \a offset pixels from the coordinate \a coordinate.
*/
QGeoMapPixmapObject::QGeoMapPixmapObject(const QGeoCoordinate &coordinate, const QPoint &offset, const QPixmap &pixmap)
    : d_ptr(new QGeoMapPixmapObjectPrivate())
{
    setOrigin(coordinate);
    d_ptr->pixmap = pixmap;
    d_ptr->offset = offset;
}
Exemplo n.º 4
0
 KeyText(const std::string& str, const sf::Font& f, float timeDuration, int l, float t)
 :sf::Text(str, f), duration(timeDuration), limb(l), timeCreated(t)
 {
     sf::FloatRect textRect =getLocalBounds();
     setOrigin(textRect.left + textRect.width/2.0f,
            textRect.top  + textRect.height/2.0f);
 }
int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
{
    VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();

    if( origin )
    {
        setOrigin( getView(), m_frame, m_gridOrigin, *origin );
        delete origin;
    }
    else
    {
        Activate();

        PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
        assert( picker );

        // TODO it will not check the toolbar button in module editor, as it uses a different ID..
        m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
        picker->SetClickHandler( boost::bind( setOrigin, getView(), m_frame, m_gridOrigin, _1 ) );
        picker->Activate();
        Wait();
    }

    return 0;
}
Exemplo n.º 6
0
	Agent(int v, Cell& c1, Cell& c2, float speed = 1.f) : AnimatedElement(Texture("grid.png"), sf::Vector2f(), 0.f, 64, 1, GameStep::player->getStyle()*8 ), c2(c2)
		{
			setOrigin(32, 32);
			setScale(.5f, .5f);

			delta = c2.getPosition() - c1.getPosition();
			float length = sqrt( delta.x * delta.x + delta.y * delta.y );
			delta /= length;

			sf::Vector2f startPos = c1.getPosition() + delta*c1.getRadius();
			sf::Vector2f endPos = c2.getPosition() - delta*c2.getRadius();
			setPosition(startPos);

			sf::Vector2f travel = endPos - startPos;
			length = sqrt( travel.x*travel.x + travel.y*travel.y );

			value = c1.sendValue(v);

			//speed *= (value < 0 ? 1.f : .5f);
			delta *= speed;

			duration = length/speed;
			elapsed = 0;

			if(value != 0) alive = true; else setColor(sf::Color::Transparent);
			if(value < 0) sprite.setTextureRect(sf::IntRect(0, 196, 64, 64));

		}
Exemplo n.º 7
0
void SPlaneSlicer::updating()
{
    this->setReslicerExtent();
    this->setReslicerAxes();

    auto image                           = this->getInput< ::fwData::Image >(s_IMAGE_IN);
    vtkSmartPointer<vtkImageData> vtkimg = vtkSmartPointer<vtkImageData>::New();

    ::fwVtkIO::toVTKImage(image, vtkimg.Get());

    m_reslicer->SetInputData(vtkimg);
    m_reslicer->Update();

    auto slice = this->getInOut< ::fwData::Image >(s_SLICE_OUT);

    ::fwVtkIO::fromVTKImage(m_reslicer->GetOutput(), slice);

    // HACK: Make output slice three-dimensional.
    // We need to do so in order to visualize it with ::visuVTKAdaptor::SImageSlice.
    // This is because the adaptor uses a vtkImageActor which doesn't handle 2d images.
    auto size = slice->getSize();
    slice->setSize({{size[0], size[1], 1}});
    auto spacing = slice->getSpacing();
    slice->setSpacing({{spacing[0], spacing[1], 0 }});
    auto origin = slice->getOrigin();
    slice->setOrigin({{origin[0], origin[1], 0}});

    auto sig = slice->signal< ::fwData::Image::ModifiedSignalType >(::fwData::Image::s_MODIFIED_SIG);

    sig->asyncEmit();
}
Exemplo n.º 8
0
void Item::Respawn( Event * )
{
	if ( _missingSkin )
	{
		ChangeSkin( _missingSkin, false );
	}
	else
	{
		showModel();
	}
	
	// allow it to be touched again
	setSolidType( SOLID_TRIGGER );
	
	// play respawn sound
	if ( playrespawn )
	{
		Sound( "snd_itemspawn" );
	}
	
	setOrigin();
	
	if ( animate->HasAnim( "respawn" ) )
		animate->RandomAnimate( "respawn", EV_Item_RespawnDone );
	
	look_at_me = true;
	has_been_looked_at = false;
}
Exemplo n.º 9
0
/**
 * Clear the display and print the string s starting from (0,0)
 * @param s The string to be printed
 */
void LCD5110::printStr(String s){

  clearScreen();
  setOrigin();
  sendStr(s);

}
Exemplo n.º 10
0
/**
 * Clear the display and print the inverted character c at (0,0)
 * @param c Character to be printed
 */
void LCD5110::printInvertedChar(byte c){

  clearScreen();
  setOrigin();
  sendInvertedChar(c);

}
// virtual
void LLFloaterObjectWeights::onOpen()
{
	const LLRect& tools_rect = gFloaterTools->getRect();
	setOrigin(tools_rect.mRight, tools_rect.mTop - getRect().getHeight());
	refresh();
	updateLandImpacts(LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel());
}
Exemplo n.º 12
0
void Camera::moveUpDiscrete() {
	Vector3 origin = getOrigin();

	origin[2] += SPEED_MOVE;

	setOrigin(origin);
}
Exemplo n.º 13
0
    // Just for testing
    static void generate_shape(EntityManager* em, float x = 4.f, float y = 1.f) {
        auto entity = em->create_entity();
        auto shape = new sf::CircleShape(1.0f);
        shape->setFillColor(sf::Color::Red);
        shape->setOrigin(1.0f, 1.0f);

        b2BodyDef body_def;
        body_def.position = b2Vec2(x, y);
        body_def.type = b2_dynamicBody;

        b2CircleShape body_shape;
        body_shape.m_p.Set(0.0f, 0.0f);
        body_shape.m_radius = 1.0f;
        b2FixtureDef fixture;
        fixture.density = 1.f;
        fixture.friction = 0.7f;
        fixture.shape = &body_shape;
        fixture.restitution = 0.1f;


        entity.add_component<rh::components::Renderable>(shape);
        entity.add_component<rh::components::Transformable>(shape);
        entity.add_component<rh::components::Physics>(body_def, fixture);

        entities.push_back(entity.id());
    }
Exemplo n.º 14
0
void Entity::EventSetSize( Event *ev )
{
	mins = ev->GetVector( 1 );
	maxs = ev->GetVector( 2 );

	setOrigin( origin );
}
Exemplo n.º 15
0
LaserSource::LaserSource(char col)
{
	setOrigin(BLOCK_SIZE/2, BLOCK_SIZE/2);
	switch(col)
	{
	case 'r':
		{
			label = '1';
			color = sf::Color::Red;
			setTexture(LaserSource::redTexture);
			break;
		}
	case 'b':
		{
			label = 'j';
			color = sf::Color::Blue;
			setTexture(LaserSource::blueTexture);
			break;		
		}
	default:
		{
			label = '1';
			color = sf::Color::Red;
			setTexture(LaserSource::redTexture);
			break;		
		}
	}
}
Exemplo n.º 16
0
void Personnage::AjustementsVisuels()
{
	setTexture(textureIddle);

	intRectsImmobile = new IntRect*[NBR_NIVEAUX];
	intRectsMouvement = new IntRect*[NBR_NIVEAUX];
	intRectsAttaque = new IntRect*[NBR_NIVEAUX];

	for (int i = 0; i < NBR_NIVEAUX; i++)
	{
		intRectsImmobile[i] = new IntRect[NBR_ANIMS_IMMOBILE];

		int largeur = textureIddle.getSize().x / NBR_ANIMS_IMMOBILE;
		int hauteur = textureIddle.getSize().y / NBR_NIVEAUX;

		for (int j = 0; j < NBR_ANIMS_IMMOBILE; j++)
		{
			intRectsImmobile[i][j].left = largeur * j;
			intRectsImmobile[i][j].top = hauteur * i;
			intRectsImmobile[i][j].width = largeur;
			intRectsImmobile[i][j].height = hauteur;
		}
	}

	for (int i = 0; i < NBR_NIVEAUX; i++)
	{
		intRectsMouvement[i] = new IntRect[NBR_ANIMS_MOUVEMENT];

		int largeur = textureMove.getSize().x / NBR_ANIMS_MOUVEMENT;
		int hauteur = textureMove.getSize().y / NBR_NIVEAUX;

		for (int j = 0; j < NBR_ANIMS_MOUVEMENT; j++)
		{
			intRectsMouvement[i][j].left = largeur * j;
			intRectsMouvement[i][j].top = hauteur * i;
			intRectsMouvement[i][j].width = largeur;
			intRectsMouvement[i][j].height = hauteur;
		}
	}

	for (int i = 0; i < NBR_NIVEAUX; i++)
	{
		intRectsAttaque[i] = new IntRect[NBR_ANIMS_ATTAQUE];

		int largeur = textureAttaque.getSize().x / NBR_ANIMS_ATTAQUE;
		int hauteur = textureAttaque.getSize().y / NBR_NIVEAUX;

		for (int j = 0; j < NBR_ANIMS_ATTAQUE; j++)
		{
			intRectsAttaque[i][j].left = largeur * j;
			intRectsAttaque[i][j].top = hauteur * i;
			intRectsAttaque[i][j].width = largeur;
			intRectsAttaque[i][j].height = hauteur;
		}
	}

	setTextureRect(intRectsImmobile[cadran][0]);

	setOrigin(intRectsImmobile[0][0].height / 2, intRectsImmobile[0][0].width / 2);
}
Exemplo n.º 17
0
qboolean Item::Drop( void )
{
	if ( !owner )
	{
		return false;
	}
	
	setOrigin( owner->origin + Vector( "0 0 40" ) );
	
	// drop the item
	PlaceItem();
	velocity = owner->velocity * 0.5f + Vector( G_CRandom( 50.0f ), G_CRandom( 50.0f ), 100.0f );
	setAngles( owner->angles );
	avelocity = Vector( 0.0f, G_CRandom( 360.0f ), 0.0f );
	
	trigger_time = level.time + 1.0f;
	
	if ( owner->isClient() )
	{
		spawnflags |= DROPPED_PLAYER_ITEM;
	}
	else
	{
		spawnflags |= DROPPED_ITEM;
	}
	
	// Remove this from the owner's item list
	owner->RemoveItem( this );
	owner = NULL;
	
	return true;
}
Exemplo n.º 18
0
ofxCamera::ofxCamera(){
    setOrigin(OF_ORIGIN);
	perspective();
	position();
	eye();
	up();
}
Exemplo n.º 19
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void GenericExample::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
/* FILTER_WIDGETCODEGEN_AUTO_GENERATED_CODE BEGIN*/

  reader->openFilterGroup(this, index);
  setStlFilePrefix( reader->readValue("StlFilePrefix", getStlFilePrefix()) );
  setMaxIterations( reader->readValue("MaxIterations", getMaxIterations()) );
  setMisorientationTolerance( reader->readValue("MisorientationTolerance", getMisorientationTolerance()) );
  setInputFile( reader->readValue("InputFile", getInputFile()) );
  setInputPath( reader->readValue("InputPath", getInputPath()) );
  setOutputFile( reader->readValue("OutputFile", getOutputFile()) );
  setOutputPath( reader->readValue("OutputPath", getOutputPath()) );
  setWriteAlignmentShifts( reader->readValue("WriteAlignmentShifts", getWriteAlignmentShifts()) );
  setConversionType( reader->readValue("ConversionType", getConversionType()) );
  setDimensions( reader->readValue("Dimensions", getDimensions()) );
  setOrigin( reader->readValue("Origin", getOrigin()) );
  setCrystalSymmetryRotations( reader->readValue("CrystalSymmetryRotations", getCrystalSymmetryRotations()) );

  setSelectedVoxelCellArrayName( reader->readValue("SelectedVoxelCellArrayName", getSelectedVoxelCellArrayName()) );
  setSelectedVoxelFieldArrayName( reader->readValue("SelectedVoxelFieldArrayName", getSelectedVoxelFieldArrayName()) );
  setSelectedVoxelEnsembleArrayName( reader->readValue("SelectedVoxelEnsembleArrayName", getSelectedVoxelEnsembleArrayName()) );
  setSelectedSurfaceMeshPointArrayName( reader->readValue("SelectedSurfaceMeshPointArrayName", getSelectedSurfaceMeshPointArrayName()) );
  setSelectedSurfaceMeshFaceArrayName( reader->readValue("SelectedSurfaceMeshFaceArrayName", getSelectedSurfaceMeshFaceArrayName()) );
  setSelectedSurfaceMeshEdgeArrayName( reader->readValue("SelectedSurfaceMeshEdgeArrayName", getSelectedSurfaceMeshEdgeArrayName()) );
  setSelectedSolidMeshPointArrayName( reader->readValue("SelectedSolidMeshPointArrayName", getSelectedSolidMeshPointArrayName()) );
  setSelectedSolidMeshFaceArrayName( reader->readValue("SelectedSolidMeshFaceArrayName", getSelectedSolidMeshFaceArrayName()) );
  setSelectedSolidMeshEdgeArrayName( reader->readValue("SelectedSolidMeshEdgeArrayName", getSelectedSolidMeshEdgeArrayName()) );


  setStrVector( reader->readValue("StrVector", getStrVector() ) );
  reader->closeFilterGroup();
}
Exemplo n.º 20
0
Robby::Robby(float x, float y, float width, float height):
sf::RectangleShape(sf::Vector2f(width,height)) {
	setFillColor(sf::Color(0, 0, 0));
	setPosition(x,y);
	setOrigin(width/2,height/2);
	setRotation(90);
}
Exemplo n.º 21
0
gkCam2ViewportRay::gkCam2ViewportRay(gkScalar x, gkScalar y, gkScalar rayLength)
{
	gkScene* pScene = gkEngine::getSingleton().getActiveScene();

	GK_ASSERT(pScene);

	gkCamera* pCamera = pScene->getMainCamera();

	GK_ASSERT(pCamera);

	gkVector2 pos(x, y);
	
	gkWindow* pWindow = pScene->getDisplayWindow();
	if (pWindow == 0)
		pWindow = gkWindowSystem::getSingleton().getMainWindow();

	GK_ASSERT(pWindow);

	gkScalar width = pWindow->getWidth();

	gkScalar height = pWindow->getHeight();

	GK_ASSERT(width && height);

	Ogre::Ray ray = pCamera->getCamera()->getCameraToViewportRay(pos.x / width, pos.y / height);

	gkVector3 p0 = ray.getOrigin();

	gkVector3 p1 = p0 + ray.getDirection() * rayLength;

	setOrigin(p0);
	setDirection(p1 - p0);
}
Exemplo n.º 22
0
BasicEnemy::BasicEnemy(Screen& screen)
    : GameObject(screen)
    , mCooldown(COOLDOWN)
    , mCanSee(false)
{
    mVertices.resize(4);
    getScreen().getGame().getResourceManager().loadSprite(this, 0, "enemyRed1.png", 0, 0);

    mSFX.setBuffer(*getScreen().getGame().getResourceManager().getSoundBuffer("sfx_laser1.ogg"));
    mSFX.setVolume(SFX_VOLUME);

//    mVelocity = sf::Vector2f(-50, -50);

    setOrigin(46, 35);
    setRotation(0);


    boundingPolygon.push_back(sf::Vector2f(10, 10));
    boundingPolygon.push_back(sf::Vector2f(0,  26));
    boundingPolygon.push_back(sf::Vector2f(11, 57));
    boundingPolygon.push_back(sf::Vector2f(81, 57));
    boundingPolygon.push_back(sf::Vector2f(92, 26));
    boundingPolygon.push_back(sf::Vector2f(82, 10));

    mHealthBar = new StatusBar2(getScreen());
}
Exemplo n.º 23
0
void BezierCurve::createCurve(QList<QPointF>& pointList, QList<qreal>& pressureList )
{
    int p = 0;
    int n = pointList.size();
    // generate the Bezier (cubic) curve from the simplified path and mouse pressure
    // first, empty everything
    while (c1.size()>0) c1.removeAt(0);
    while (c2.size()>0) c2.removeAt(0);
    while (vertex.size()>0) vertex.removeAt(0);
    while (selected.size()>0) selected.removeAt(0);
    while (pressure.size()>0) pressure.removeAt(0);

    setOrigin( pointList.at(0) );
    selected.append(false);
    pressure.append(pressureList.at(0));

    for(p=1; p<n; p++)
    {
        c1.append(pointList.at(p));
        c2.append(pointList.at(p));
        vertex.append(pointList.at(p));
        pressure.append(pressureList.at(p));
        selected.append(false);

    }
    smoothCurve();
    //colourNumber = 0;
    feather = 0;
}
Exemplo n.º 24
0
void QwtCompass::initCompass()
{
    d_data = new PrivateData;

    setScaleOptions(ScaleLabel); // Only labels, no backbone, no ticks

    setOrigin(270.0);
    setWrapping(true);


    d_data->labelMap.insert(0.0, QString::fromLatin1("N"));
    d_data->labelMap.insert(45.0, QString::fromLatin1("NE"));
    d_data->labelMap.insert(90.0, QString::fromLatin1("E"));
    d_data->labelMap.insert(135.0, QString::fromLatin1("SE"));
    d_data->labelMap.insert(180.0, QString::fromLatin1("S"));
    d_data->labelMap.insert(225.0, QString::fromLatin1("SW"));
    d_data->labelMap.insert(270.0, QString::fromLatin1("W"));
    d_data->labelMap.insert(315.0, QString::fromLatin1("NW"));

#if 0
    d_data->labelMap.insert(22.5, QString::fromLatin1("NNE"));
    d_data->labelMap.insert(67.5, QString::fromLatin1("NEE"));
    d_data->labelMap.insert(112.5, QString::fromLatin1("SEE"));
    d_data->labelMap.insert(157.5, QString::fromLatin1("SSE"));
    d_data->labelMap.insert(202.5, QString::fromLatin1("SSW"));
    d_data->labelMap.insert(247.5, QString::fromLatin1("SWW"));
    d_data->labelMap.insert(292.5, QString::fromLatin1("NWW"));
    d_data->labelMap.insert(337.5, QString::fromLatin1("NNW"));
#endif
}
Exemplo n.º 25
0
void EnemyLog::update(float deltaTime   , Background *bg) {
    _aliveTimer += deltaTime;
    if(!_destroying && _aliveTimer > 5) {
        //_alive = false;
        _index = 0;
        _destroying = true;
        _animTimer.restart();
        move(-31, -31);
    }

    if(_spawning){
        updateSprite(true);
        return;
    }
    if(_destroying){
        updateSprite(false);
        return;
    }

    setTexture(*_texture, true);
    if(getOrigin().x == 0){
        setPosition(getPosition().x + getLocalBounds().width/2+32, getPosition().y + getLocalBounds().height/2+32);
        setOrigin( getLocalBounds().width/2, getLocalBounds().height/2);
    }

    movement(deltaTime, bg);

}
Exemplo n.º 26
0
/**
 * Updates position of the Stand & Stop Flying panel to be center aligned with Move button.
 */
void LLPanelStandStopFlying::updatePosition()
{
	if (mAttached) return;

	S32 y_pos = 0;
	S32 bottom_tb_center = 0;
	if (LLToolBar* toolbar_bottom = gToolBarView->getChild<LLToolBar>("toolbar_bottom"))
	{
		y_pos = toolbar_bottom->getRect().getHeight();
		bottom_tb_center = toolbar_bottom->getRect().getCenterX();
	}

	S32 left_tb_width = 0;
	if (LLToolBar* toolbar_left = gToolBarView->getChild<LLToolBar>("toolbar_left"))
	{
		left_tb_width = toolbar_left->getRect().getWidth();
	}

	if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container"))
	{
		panel_ssf_container->setOrigin(0, y_pos);
	}

	S32 x_pos = bottom_tb_center-getRect().getWidth()/2 - left_tb_width;

	setOrigin( x_pos, 0);
}
Exemplo n.º 27
0
Ray::Ray(const Point3 origin, const Point3 end) {
    Vector3 dirc = end - origin;

    setDirection(dirc); //Vector3(origin, end)
    setInvDirection(dirc);
    setOrigin(Vector3(origin.x, origin.y, origin.z));
}
Exemplo n.º 28
0
/*!
  \brief Constructor
  \param parent Parent widget
  \param name Widget name

  Create a compass widget with a scale, no needle and no rose. 
  The default origin is 270.0 with no valid value. It accepts
  mouse and keyboard inputs and has no step size. The default mode
  is QwtDial::RotateNeedle.
*/  
QwtCompass::QwtCompass(QWidget* parent, const char* name):
        QwtDial(parent, name),
    d_rose(0)
{
    setScaleOptions(ScaleLabel); // Only labels, no backbone, no ticks

    setOrigin(270.0);
    setWrapping(TRUE);


    d_labelMap.insert(0.0, QString::fromLatin1("N"));
    d_labelMap.insert(45.0, QString::fromLatin1("NE"));
    d_labelMap.insert(90.0, QString::fromLatin1("E"));
    d_labelMap.insert(135.0, QString::fromLatin1("SE"));
    d_labelMap.insert(180.0, QString::fromLatin1("S"));
    d_labelMap.insert(225.0, QString::fromLatin1("SW"));
    d_labelMap.insert(270.0, QString::fromLatin1("W"));
    d_labelMap.insert(315.0, QString::fromLatin1("NW"));

#if 0
    d_labelMap.insert(22.5, QString::fromLatin1("NNE"));
    d_labelMap.insert(67.5, QString::fromLatin1("NEE"));
    d_labelMap.insert(112.5, QString::fromLatin1("SEE"));
    d_labelMap.insert(157.5, QString::fromLatin1("SSE"));
    d_labelMap.insert(202.5, QString::fromLatin1("SSW"));
    d_labelMap.insert(247.5, QString::fromLatin1("SWW"));
    d_labelMap.insert(292.5, QString::fromLatin1("NWW"));
    d_labelMap.insert(337.5, QString::fromLatin1("NNW"));
#endif
}
Exemplo n.º 29
0
void LLCoordFrame::lookAt(const LLVector3 &origin, const LLVector3 &point_of_interest, const LLVector3 &up_direction)
{
	setOrigin(origin);
	LLVector3 at(point_of_interest - origin);
	at.normVec();
	lookDir(at, up_direction);
}
Exemplo n.º 30
0
void QGeoMapPixmapObject::setCoordinate(const QGeoCoordinate &coordinate)
{
    if (origin() != coordinate) {
        setOrigin(coordinate);
        emit coordinateChanged(coordinate);
    }
}