Exemple #1
0
AGE_Vector4D::AGE_Vector4D(const AGE_PointF &point)
{
    setX(point.x());
    setY(point.y());
    setZ(0);
    setW(0);
}
HomogenusPosition::HomogenusPosition(const Vector3& vec)
{
	setX(vec.getX());
	setY(vec.getY());
	setZ(vec.getZ());
	setW(1.0f);
};
Exemple #3
0
AGE_Vector4D::AGE_Vector4D(const AGE_Vector2D &vector,float zpos,float wpos)
{
    setX(vector.x());
    setY(vector.y());
    setZ(zpos);
    setW(wpos);
}
Exemple #4
0
AGE_Vector4D::AGE_Vector4D(const AGE_Vector3D &vector)
{
    setX(vector.x());
    setY(vector.y());
    setZ(vector.z());
    setW(0);
}
Exemple #5
0
void Rect::grow(float amount) {

    setX(getX() - amount);
    setY(getY() - amount);
    setW(getW() + amount * 2);
    setH(getH() + amount * 2);
}
Exemple #6
0
GEBackground::GEBackground(int x, int y,std::string spriteloc) : GObject(x,y,0,0,true)
{
	this->setSprite(spriteloc);
	setW(getSprite()->w);
	setH(getSprite()->h);

}
Exemple #7
0
AGE_Vector4D::AGE_Vector4D(const AGE_Vector3D &vector,float wpos)
{
    setX(vector.x());
    setY(vector.y());
    setZ(vector.z());
    setW(wpos);
}
Exemple #8
0
AGE_Vector4D::AGE_Vector4D(float xpos, float ypos, float zpos, float wpos)
{
    setX(xpos);
    setY(ypos);
    setZ(zpos);
    setW(wpos);
}
Exemple #9
0
void Objets::setPlan(int _x, int _y, int _w, int _h) {
    setX(_x);
    setY(_y);
    setW(_w);
    setH(_h);
    genererModelisation();
}
Exemple #10
0
AGE_Vector4D::AGE_Vector4D(const QVector4D &vector)
{
    setX(vector.x());
    setY(vector.y());
    setZ(vector.z());
    setW(vector.w());
}
Exemple #11
0
D3Q15Lattice::D3Q15Lattice(const int Nx, const int Ny, const int Nz):
Lattice(Nx,Ny,Nz),
ex{0,1,-1,0,0,0,0,1,-1,1,-1,1,-1,1,-1},
ey{0,0,0,1,-1,0,0,1,1,-1,-1,1,1,-1,-1},
ez{0,0,0,0,0,1,-1,1,1,1,1,-1,-1,-1,-1},
w{2.f/9.f,1.f/9.f,1.f/9,1.f/9.f,1.f/9.f,1.f/9.f,1.f/9.f,
    1.f/72.f,1.f/72.f,1.f/72.f,1.f/72.f,
    1.f/72.f,1.f/72.f,1.f/72.f,1.f/72.f},
bbSpd{0,2,1,4,3,6,5,14,13,12,11,10,9,8,7},
Qflat{1./3.,0.,0.,0,-1./3.,0,0,0,-1./3.,  //this is embarrassing, but better than implementing the LA
	2./3.,0,0,0,-1./3.,0,0,0,-1./3.,
	2./3.,0,0,0,-1./3.,0,0,0,-1./3.,
	-1./3.,0,0,0,2./3.,0,0,0,-1./3.,
	-1./3.,0,0,0,2./3.,0,0,0,-1./3.,
	-1./3.,0,0,0,-1./3.,0,0,0,2./3.,
	-1./3.,0,0,0,-1./3.,0,0,0,2./3.,
	2./3.,1,1,1,2./3.,1,1,1,2./3.,
	2./3.,-1,-1,-1,2./3.,1,-1,1,2./3.,
	2./3.,-1,1,-1,2./3.,-1,1,-1,2./3.,
	2./3.,1,-1,1,2./3.,-1,-1,-1,2./3.,
	2./3.,1,-1,1,2./3.,-1,-1,-1,2./3.,
	2./3.,-1,1,-1,2./3.,-1,1,-1,2./3.,
	2./3.,-1,-1,-1,2./3.,1,-1,1,2./3.,
	2./3.,1,1,1,2./3.,1,1,1,2./3.}
{
	// direct base-class pointers to lattice variables
	setNumSpd(numSpd);
	setEx(ex);
	setEy(ey);
	setEz(ez);
	setW(w);
	setBBspd(bbSpd);
	setQflat(Qflat);

}
/****************************************************************************
**
** Copyright (C) 2016
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include <QVBoxLayout>
#include <QLabel>
#include <QRegExpValidator>
#include "asset_propertywidget_quaternion.h"

namespace Magus
{
    //****************************************************************************/
    QtQuaternionProperty::QtQuaternionProperty(const QString& title,
                                               qreal w,
                                               qreal x,
                                               qreal y,
                                               qreal z,
                                               QWidget* parent) :
        QtProperty(parent),
        mPrecision(3)
    {
        QVBoxLayout* mainLayout = new QVBoxLayout;
        QHBoxLayout* horizontalLayout = new QHBoxLayout;
        QHBoxLayout* quaternionLayout = new QHBoxLayout;
        QHBoxLayout* wLayout = new QHBoxLayout;
        QHBoxLayout* xLayout = new QHBoxLayout;
        QHBoxLayout* yLayout = new QHBoxLayout;
        QHBoxLayout* zLayout = new QHBoxLayout;
        mainLayout->setContentsMargins(5, 0, 5, 0);
        QLabel* label = new QLabel(title);
        QLabel* wLabel = new QLabel(QString("W"));
        QLabel* xLabel = new QLabel(QString("X"));
        QLabel* yLabel = new QLabel(QString("Y"));
        QLabel* zLabel = new QLabel(QString("Z"));
        mWEdit = new QLineEdit;
        mXEdit = new QLineEdit;
        mYEdit = new QLineEdit;
        mZEdit = new QLineEdit;
        QRegExp regularExpression("[+-]?([0-9]+\\.([0-9]+)?|\\.[0-9]+)([eE][+-]?[0-9]+)?"); // floating point
        QRegExpValidator* validator = new QRegExpValidator(regularExpression);
        mWEdit->setValidator(validator);
        mXEdit->setValidator(validator);
        mYEdit->setValidator(validator);
        mZEdit->setValidator(validator);
        setQuaternion(w, x, y, z);
        connect(mWEdit, SIGNAL(textEdited(QString)), this, SLOT(propertyValueChanged(void)));
        connect(mXEdit, SIGNAL(textEdited(QString)), this, SLOT(propertyValueChanged(void)));
        connect(mYEdit, SIGNAL(textEdited(QString)), this, SLOT(propertyValueChanged(void)));
        connect(mZEdit, SIGNAL(textEdited(QString)), this, SLOT(propertyValueChanged(void)));

        // Layout
        wLayout->addWidget(wLabel, 1);
        wLayout->addWidget(mWEdit, 100);
        xLayout->addWidget(xLabel, 1);
        xLayout->addWidget(mXEdit, 100);
        yLayout->addWidget(yLabel, 1);
        yLayout->addWidget(mYEdit, 100);
        zLayout->addWidget(zLabel, 1);
        zLayout->addWidget(mZEdit, 100);
        quaternionLayout->addLayout(wLayout);
        quaternionLayout->addLayout(xLayout);
        quaternionLayout->addLayout(yLayout);
        quaternionLayout->addLayout(zLayout);
        horizontalLayout->addWidget(label, 1);
        horizontalLayout->addLayout(quaternionLayout, 2);
        mainLayout->addLayout(horizontalLayout);
        setLayout(mainLayout);
        mType = QUATERNION;
    }

    //****************************************************************************/
    void QtQuaternionProperty::setQuaternion(qreal w, qreal x, qreal y, qreal z)
    {
        setW(w);
        setX(x);
        setY(y);
        setZ(z);
    }

    //****************************************************************************/
    void QtQuaternionProperty::setQuaternion(const QQuaternion& q)
    {
        setW(q.scalar());
        setX(q.x());
        setY(q.y());
        setZ(q.z());
    }
Exemple #13
0
Vector4D& Vector4D::operator/=(const Vector4D& vector)
{
	setX(x() / vector.x());
	setY(y() / vector.y());
	setZ(z() / vector.z());
	setW(w() / vector.w());
	return *this;
}
Exemple #14
0
Vector4D& Vector4D::operator/=(float d)
{
	setX(x() / d);
	setY(y() / d);
	setZ(z() / d);
	setW(w() / d);
	return *this;
}
Exemple #15
0
Vector4D& Vector4D::operator*=(float m)
{
	setX(x() * m);
	setY(y() * m);
	setZ(z() * m);
	setW(w() * m);
	return *this;
}
Exemple #16
0
Ship::Ship(void){
	setW(0);
	setH(0);
	setHp(1);
	setScore(0);
	setFlag(0);
	return ;
}
Exemple #17
0
Ship::Ship(unsigned int w, unsigned int h, unsigned int hp, unsigned int score, unsigned int flag) {
	setW(w);
	setH(h);
	setHp(hp);
	setScore(score);
	setFlag(flag);
	return ;
}
            Quaternion& Quaternion::normalize() {
                const double normal = sqrt(getW()*getW() + getX()*getX() + getY()*getY() + getZ()*getZ());
                if (normal < Quaternion::EPSILON) {
                    setW(1.0);
                    setX(0);
                    setY(0);
                    setZ(0);
                }
                else {
                    const double reciprocal = 1.0/normal;

                    setW(reciprocal * getW());
                    setX(reciprocal * getX());
                    setY(reciprocal * getY());
                    setZ(reciprocal * getZ());
                }
                return (*this);
            }
Exemple #19
0
LawnMower::LawnMower()
{
    setX(350);
    setY(198);
    setW(50);
    setH(50);
    setType("LawnMower");
    setHealthImpact(25);
    isCollided = false;
}
Exemple #20
0
Hole::Hole()
{
    setX(150);
    setY(208);
    setW(75);
    setH(300);
    setType("Hole");
    setHealthImpact(100);
    isCollided = false;
}
Exemple #21
0
MadDog::MadDog()
{
    setX(250);
    setY(177);
    setW(75);
    setH(75);
    setType("MadDog");
    setHealthImpact(50);
    isCollided = false;

}
Exemple #22
0
inline void remove(int town)
{
    int set1 = min_total_index[town] / sizes[town], set2 = (cnt[town] - 1) / sizes[town];
    setW(town, min_total_index[town], getW(town, cnt[town] - 1));
    cnt[town]--;

    updateSet(town, set1);
    if (set2 != set1)
        updateSet(town, set2);
    updateTotal(town);
}
Exemple #23
0
void CSulGuiAlign::onViewResize( float w, float h )
{
	// the align element doesn't have a size,.. so we need to create a size for it
	// right now if there is a parent window we use that size, otherwise we use the size of
	// the application window
	// NOTE: this is not correct.. when rendering to a texture the highest window is not the
	// application but the RTT texture
	CSulGuiCanvas* p = dynamic_cast<CSulGuiCanvas*>(getParent(0));
	setW( p?p->getW():w );
	setH( p?p->getH():h );

	update();
}
Exemple #24
0
	// ***************************************************************************
	bool CDBViewDigit::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
	{
		if(!CViewBase::parse(cur, parentGroup))
			return false;

		CViewRenderer &rVR = *CViewRenderer::getInstance();

		// link to the db
		CXMLAutoPtr ptr;
		ptr = xmlGetProp (cur, (xmlChar*)"value");
		if ( ptr )
			_Number.link ( ptr );
		else
		{
			nlinfo ("no value in %s", _Id.c_str());
			return false;
		}

		// read options
		ptr = xmlGetProp (cur, (xmlChar*)"numdigit");
		if(ptr)	fromString((const char*)ptr, _NumDigit);
		clamp(_NumDigit, 1, 10);

		ptr = xmlGetProp (cur, (xmlChar*)"wspace");
		if(ptr)	fromString((const char*)ptr, _WSpace);

		ptr= (char*) xmlGetProp( cur, (xmlChar*)"color" );
		_Color = CRGBA(255,255,255,255);
		if (ptr)
			_Color = convertColor (ptr);

		// compute window size. Remove one space.
		sint32	wDigit= rVR.getFigurTextureW();
		sint32	hDigit= rVR.getFigurTextureH();
		setW((wDigit+_WSpace)*_NumDigit - _WSpace);
		setH(hDigit);

		// some init
		// For _NumDigit=2; set the divBase to 100, etc...
		_DivBase= 1;
		for(uint i= 0;i<(uint)_NumDigit;i++)
		{
			_DivBase*= 10;
		}

		// init cache.
		_Cache= -1;

		return true;
	}
            Quaternion& Quaternion::inverse() {
                double normal = sqrt(getW()*getW() + getX()*getX() + getY()*getY() + getZ()*getZ());
                if (normal < Quaternion::EPSILON) {
                    normal = 1.0;
                }

                const double reciprocal = 1.0/normal;

                setW(reciprocal * getW());
                setX(reciprocal * (-1) * getX());
                setY(reciprocal * (-1) * getY());
                setZ(reciprocal * (-1) * getZ());

                return (*this);
            }
            Quaternion& Quaternion::transform(const double &angle, const Point3 &dir) {
                double length = dir.length();
                if (length > Quaternion::EPSILON) {
                    Point3 p(dir);
                    p.normalize();

                    const double omega = -0.5 * angle; // TODO: Eigentlich positiv!!
                    const double sinOmega = sin(omega);

                    setW(cos(omega));
                    setX(sinOmega * p.getX());
                    setY(sinOmega * p.getY());
                    setZ(sinOmega * p.getZ());
                }
                else {
                    setW(1.0);
                    setX(0);
                    setY(0);
                    setZ(0);
                }
                normalize();

                return (*this);
            }
Exemple #27
0
CuriousCat::CuriousCat(QWidget *parent)
{
    setX(128);
    setY(450);
    setW(192);
    setH(192);
    setType("CuriousCat");
    //jumpSpeed = 100;
    //gravity = 0;
    height = 0;
    speed = 200;
    isClimbing = false;
    isFalling = false;
    isLanded = true;
    counter = 0;




    catMovie = new QMovie(":/cat.gif");
    cat = new QLabel(parent);
    cat->setMovie(catMovie);
    catMovie->start();
    cat->setGeometry(128,450, 192, 192);
    cat->setScaledContents(true);

    cat->show();

    QLabel * mouthSensor = new QLabel(parent);
    mouthSensor->setGeometry(mouthX, mouthY, sensorW, sensorH);
    catSensors.push_back(mouthSensor);


    QLabel * frontPawSensor = new QLabel(parent);
    frontPawSensor->setGeometry(frontPawX,frontPawY, sensorW,sensorH);
    catSensors.push_back(frontPawSensor);


    QLabel * backPawSensor = new QLabel(parent);
    backPawSensor->setGeometry(frontPawX - 75, frontPawY, sensorW, sensorH);
    catSensors.push_back(backPawSensor);



}
Exemple #28
0
inline void insert(int town, int w)
{
    int place = cnt[town];
    setW(town, place, w);
    cnt[town]++;

    int set = place / sizes[town];
    if (min[ws_start[town] + set] > w)
    {
        min[ws_start[town] + set] = w;
        min_indices[ws_start[town] + set] = place;
        if (min_total[town] > w)
        {
            min_total[town] = w;
            min_total_index[town] = place;

            if (cnt[town] == 1)
                insert2(w, town);
            else
                update2(w, town);
        }
    }
}
Exemple #29
0
void PataponPopup::setSize(int w, int h)
{
	setW(w);
	setH(h);
	updateGeometry();
}
Exemple #30
0
Word_ :: Word_( unsigned int size , char* word)
{
	setW(size,word); // initialize class by char buffer
}