Beispiel #1
0
static void Scale_Triangle(OBJECT *Object, VECTOR Vector, TRANSFORM * /*Trans*/)
{
  /*DBL Length;*/
  TRIANGLE *Triangle = (TRIANGLE *)Object;

  if (!Test_Flag(Object, DEGENERATE_FLAG))
  {
/*  BEG ROSE
    this is useless, because Compute_Triangle recalculates this anyway:
    Triangle->Normal_Vector[X] = Triangle->Normal_Vector[X] / Vector[X];
    Triangle->Normal_Vector[Y] = Triangle->Normal_Vector[Y] / Vector[Y];
    Triangle->Normal_Vector[Z] = Triangle->Normal_Vector[Z] / Vector[Z];

    VLength(Length, Triangle->Normal_Vector);

    VInverseScaleEq(Triangle->Normal_Vector, Length);

    Triangle->Distance /= Length;
    END ROSE */

    VEvaluateEq(Triangle->P1, Vector);
    VEvaluateEq(Triangle->P2, Vector);
    VEvaluateEq(Triangle->P3, Vector);

    Compute_Triangle(Triangle, false);
  }
}
Beispiel #2
0
static void Transform_Smooth_Triangle(OBJECT *Object, TRANSFORM *Trans)
{
  SMOOTH_TRIANGLE *Triangle = (SMOOTH_TRIANGLE *)Object;

  if (!Test_Flag(Object, DEGENERATE_FLAG))
  {
/*  BEG ROSE
    This is useless, because Compute_Triange recalculates this anyway:
    MTransPoint(Triangle->Normal_Vector,Triangle->Normal_Vector, Trans);
    END ROSE */
    MTransPoint(Triangle->P1, Triangle->P1, Trans);
    MTransPoint(Triangle->P2, Triangle->P2, Trans);
    MTransPoint(Triangle->P3, Triangle->P3, Trans);
/*  BEG ROSE
    This code is definitely wrong:
    MTransPoint(Triangle->N1, Triangle->N1, Trans);
    MTransPoint(Triangle->N2, Triangle->N2, Trans);
    MTransPoint(Triangle->N3, Triangle->N3, Trans);
    Bug fix for this: */
    MTransNormal(Triangle->N1,Triangle->N1,Trans);
    MTransNormal(Triangle->N2,Triangle->N2,Trans);
    MTransNormal(Triangle->N3,Triangle->N3,Trans);
/*  END ROSE */

    Compute_Triangle((TRIANGLE *)Triangle, true);
  }
}
Beispiel #3
0
void Triangle::Transform(const TRANSFORM *tr)
{
    if(!Test_Flag(this, DEGENERATE_FLAG))
    {
        MTransPoint(P1, P1, tr);
        MTransPoint(P2, P2, tr);
        MTransPoint(P3, P3, tr);

        Compute_Triangle();
    }
}
Beispiel #4
0
void Triangle::Scale(const Vector3d& Vector, const TRANSFORM *)
{
    if(!Test_Flag(this, DEGENERATE_FLAG))
    {
        P1 *= Vector;
        P2 *= Vector;
        P3 *= Vector;

        Compute_Triangle();
    }
}
Beispiel #5
0
void Triangle::Translate(const Vector3d& Vector, const TRANSFORM *)
{
    if(!Test_Flag(this, DEGENERATE_FLAG))
    {
        P1 += Vector;
        P2 += Vector;
        P3 += Vector;

        Compute_Triangle();
    }
}
Beispiel #6
0
static void Transform_Triangle(OBJECT *Object, TRANSFORM *Trans)
{
  TRIANGLE *Triangle = (TRIANGLE *)Object;

  if (!Test_Flag(Object, DEGENERATE_FLAG))
  {
/*  ROSE BEG
    this is useless, because Compute_Triangle recalculates this anyway:
    MTransPoint(Triangle->Normal_Vector,Triangle->Normal_Vector, Trans);
    END ROSE */
    MTransPoint(Triangle->P1, Triangle->P1, Trans);
    MTransPoint(Triangle->P2, Triangle->P2, Trans);
    MTransPoint(Triangle->P3, Triangle->P3, Trans);

    Compute_Triangle(Triangle, false);
  }
}
Beispiel #7
0
void SmoothTriangle::Scale(const Vector3d& Vector, const TRANSFORM *)
{
    if(!Test_Flag(this, DEGENERATE_FLAG))
    {
        P1 *= Vector;
        P2 *= Vector;
        P3 *= Vector;

        N1 /= Vector;
        N1.normalize();
        N2 /= Vector;
        N2.normalize();
        N3 /= Vector;
        N3.normalize();

        Compute_Triangle();
    }
}
Beispiel #8
0
static void Scale_Smooth_Triangle(OBJECT *Object, VECTOR Vector, TRANSFORM * /*Trans*/)
{
  DBL Length;
  SMOOTH_TRIANGLE *Triangle = (SMOOTH_TRIANGLE *)Object;

  if (!Test_Flag(Object, DEGENERATE_FLAG))
  {
/*  BEG ROSE
    this is useless, because Compute_Triange recalculates this anyway:
    Triangle->Normal_Vector[X] = Triangle->Normal_Vector[X] / Vector[X];
    Triangle->Normal_Vector[Y] = Triangle->Normal_Vector[Y] / Vector[Y];
    Triangle->Normal_Vector[Z] = Triangle->Normal_Vector[Z] / Vector[Z];

    VLength(Length, Triangle->Normal_Vector);
    VScaleEq(Triangle->Normal_Vector, 1.0 / Length);
    Triangle->Distance /= Length;
    END ROSE */

    VEvaluateEq(Triangle->P1, Vector);
    VEvaluateEq(Triangle->P2, Vector);
    VEvaluateEq(Triangle->P3, Vector);

/*  BEG ROSE
    The normal vectors also have to be transformed (BUG fix): */
    Triangle->N1[X] /= Vector[X];
    Triangle->N1[Y] /= Vector[Y];
    Triangle->N1[Z] /= Vector[Z];
    VLength(Length,Triangle->N1);
    VScaleEq(Triangle->N1,1.0/Length);
    Triangle->N2[X] /= Vector[X];
    Triangle->N2[Y] /= Vector[Y];
    Triangle->N2[Z] /= Vector[Z];
    VLength(Length,Triangle->N2);
    VScaleEq(Triangle->N2,1.0/Length);
    Triangle->N3[X] /= Vector[X];
    Triangle->N3[Y] /= Vector[Y];
    Triangle->N3[Z] /= Vector[Z];
    VLength(Length,Triangle->N3);
    VScaleEq(Triangle->N3,1.0/Length);
/*  END ROSE */

    Compute_Triangle((TRIANGLE *)Triangle,true);
  }
}
Beispiel #9
0
static void Translate_Triangle(OBJECT *Object, VECTOR Vector, TRANSFORM * /*Trans*/)
{
  TRIANGLE *Triangle = (TRIANGLE *)Object;
  /*VECTOR Translation;*/

  if (!Test_Flag(Triangle, DEGENERATE_FLAG))
  {
/* BEG ROSE
   this is useless, because Compute_Triangle recalculates this anyway:
    VEvaluate(Translation, Triangle->Normal_Vector, Vector);

    Triangle->Distance -= Translation[X] + Translation[Y] + Translation[Z];
   END ROSE */

    VAddEq(Triangle->P1, Vector);
    VAddEq(Triangle->P2, Vector);
    VAddEq(Triangle->P3, Vector);

    Compute_Triangle(Triangle, false);
  }
}