示例#1
0
        public virtual void Translate(double tx, double ty, double tz)
        {
            Transformacao4D newTransform = new Transformacao4D();

            newTransform.AtribuirTranslacao(tx, ty, tz);

            transform = newTransform.TransformMatrix(transform);
            boundBox.AtualizarBBox(this.vertices, transform);
        }
示例#2
0
        public void Rotate(double degreeFactor)
        {
            Ponto4D         center = boundBox.ObterCentro;
            Transformacao4D translationTransform        = new Transformacao4D();
            Transformacao4D rotationTransform           = new Transformacao4D();
            Transformacao4D translationTransformInverse = new Transformacao4D();

            translationTransform.AtribuirTranslacao(center.X, center.Y, 0);

            rotationTransform.AtribuirRotacaoZ(Transformacao4D.DEG_TO_RAD * degreeFactor);

            center.InvertSignals();
            translationTransformInverse.AtribuirTranslacao(center.X, center.Y, 0);

            Transformacao4D finalTransform = translationTransform.TransformMatrix(rotationTransform);

            finalTransform = finalTransform.TransformMatrix(translationTransformInverse);
            transform      = finalTransform.TransformMatrix(transform);

            boundBox.AtualizarBBox(this.vertices, transform);
        }
示例#3
0
        public virtual void Scale(double factor)
        {
            Ponto4D center = boundBox.ObterCentro;

            Transformacao4D globalTransform             = new Transformacao4D();
            Transformacao4D translationTransform        = new Transformacao4D();
            Transformacao4D translationTransformInverse = new Transformacao4D();
            Transformacao4D scaleTransform = new Transformacao4D();

            translationTransform.AtribuirTranslacao(center.X, center.Y, center.Z);
            globalTransform = translationTransform.TransformMatrix(globalTransform);

            scaleTransform.AtribuirEscala(factor, 1.0, 1.0);
            globalTransform = scaleTransform.TransformMatrix(globalTransform);

            center.InvertSignals();
            translationTransformInverse.AtribuirTranslacao(center.X, center.Y, center.Z);
            globalTransform = translationTransformInverse.TransformMatrix(globalTransform);

            transform = transform.TransformMatrix(globalTransform);

            boundBox.AtualizarBBox(this.vertices, transform);
        }