Ejemplo n.º 1
0
VART::Point4D VART::Transform::operator *(const VART::Point4D& point) const
{
    VART::Point4D result;

    return VART::Point4D(  matrix[0]*point.GetX()  + matrix[4]*point.GetY()
                     + matrix[8]*point.GetZ()  + matrix[12]*point.GetW(),
                       matrix[1]*point.GetX()  + matrix[5]*point.GetY()
                     + matrix[9]*point.GetZ()  + matrix[13]*point.GetW(),
                       matrix[2]*point.GetX()  + matrix[6]*point.GetY()
                     + matrix[10]*point.GetZ() + matrix[14]*point.GetW(),
                       matrix[3]*point.GetX()  + matrix[7]*point.GetY()
                     + matrix[11]*point.GetZ() + matrix[15]*point.GetW());
}
Ejemplo n.º 2
0
void VART::Transform::MakeTranslation(const VART::Point4D& translationVector)
{
    MakeIdentity();
    matrix[12] = translationVector.GetX();
    matrix[13] = translationVector.GetY();
    matrix[14] = translationVector.GetZ();
}
Ejemplo n.º 3
0
void VART::Transform::MakeRotation(const VART::Point4D& refVec, const float radians)
{
    VART::Point4D projEmY;
    VART::Point4D vetTemp;
    VART::Transform tTemp;
    double anguloY;
    double anguloZ;

    //Decompor refVec
    //Angulo em Y (para levar o vetor ao plano XY)
    if (Zero(refVec.GetZ()))
    {
        anguloY = 0.0;
        this->MakeIdentity();
        vetTemp = refVec;
    }
    else
    {
        // se o vetor nao esta no plano XY...
        projEmY.SetXYZW(refVec.GetX(), 0, refVec.GetZ(), 0);
        projEmY.Normalize();
        if (refVec.GetZ() < 0)
            anguloY = -(projEmY.AngleTo(VART::Point4D(1,0,0,0)));
        else
            anguloY = projEmY.AngleTo(VART::Point4D(1,0,0,0));
        this->MakeYRotation(anguloY);
        vetTemp = (*this) * refVec; //refVec no plano XY
    }
    //Angulo em Z (para levar o vetor ao X)
    if (vetTemp.GetY() < 0)
        anguloZ = vetTemp.AngleTo(VART::Point4D(1,0,0,0));
    else
        anguloZ = -(vetTemp.AngleTo(VART::Point4D(1,0,0,0)));
    tTemp.MakeZRotation(anguloZ);
    this->CopyMatrix(tTemp * (*this));
    //Rodar
    tTemp.MakeXRotation(radians);
    this->CopyMatrix(tTemp * (*this));
    //voltar
    tTemp.MakeZRotation(-anguloZ);
    this->CopyMatrix(tTemp * (*this));
    tTemp.MakeYRotation(-anguloY);
    this->CopyMatrix(tTemp * (*this));
}
Ejemplo n.º 4
0
bool VART::BoundingBox::testPoint( VART::Point4D p )
{
	std::cout << "Test point" << std::endl;
	
    if (p.GetX() < smallerX)
        return false;
    if (p.GetX() > greaterX)
        return false;
    if (p.GetZ() < smallerZ)
        return false;
    if (p.GetZ() > greaterZ)
        return false;
    if (p.GetY() < smallerY)
        return false;
    if (p.GetY() > greaterY)
        return false;
    return true;

}
Ejemplo n.º 5
0
void VART::BoundingBox::ApplyTransform(const VART::Transform& trans) {
    VART::BoundingBox box = *this;

    VART::Point4D ptoBBox = trans * VART::Point4D(box.GetSmallerX(),box.GetSmallerY(),box.GetSmallerZ());
    this->SetBoundingBox(ptoBBox.GetX(),ptoBBox.GetY(),ptoBBox.GetZ(),ptoBBox.GetX(),ptoBBox.GetY(),ptoBBox.GetZ());
    this->ConditionalUpdate(trans * VART::Point4D(box.GetSmallerX(), box.GetSmallerY(), box.GetGreaterZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetSmallerX(), box.GetGreaterY(), box.GetGreaterZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetSmallerX(), box.GetGreaterY(), box.GetSmallerZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetGreaterX(), box.GetSmallerY(), box.GetSmallerZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetGreaterX(), box.GetSmallerY(), box.GetGreaterZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetGreaterX(), box.GetGreaterY(), box.GetGreaterZ()));
    this->ConditionalUpdate(trans * VART::Point4D(box.GetGreaterX(), box.GetGreaterY(), box.GetSmallerZ()));
    ProcessCenter();
}
Ejemplo n.º 6
0
void VART::BoundingBox::ConditionalUpdate(const VART::Point4D& point) {
    ConditionalUpdate(point.GetX(), point.GetY(), point.GetZ());
}