Beispiel #1
0
void Compute_Coordinate_Transform(TRANSFORM *trans, const VECTOR origin, VECTOR up, DBL radius, DBL length)
{
	TRANSFORM trans2;
	VECTOR tmpv;

	Make_Vector(tmpv, radius, radius, length);

	Compute_Scaling_Transform(trans, tmpv);

	if (fabs(up[Z]) > 1.0 - EPSILON)
	{
		Make_Vector(tmpv, 1.0, 0.0, 0.0);
		up[Z] = up[Z] < 0.0 ? -1.0 : 1.0;
	}
	else
	{
		Make_Vector(tmpv, -up[Y], up[X], 0.0);
	}

	Compute_Axis_Rotation_Transform(&trans2, tmpv, acos(up[Z]));

	Compose_Transforms(trans, &trans2);

	Compute_Translation_Transform(&trans2, origin);

	Compose_Transforms(trans, &trans2);
}
Beispiel #2
0
void Parametric::Transform(const TRANSFORM* tr)
{
	if(Trans == NULL)
		Trans = Create_Transform();
	Compose_Transforms(Trans, tr);
	Compute_BBox();
}
Beispiel #3
0
void Transform_Object (ObjectPtr Object, const TRANSFORM *Trans)
{
	if (Object == NULL)
		return;

	for(vector<ObjectPtr>::iterator Sib = Object->Bound.begin(); Sib != Object->Bound.end(); Sib++)
	{
		Transform_Object(*Sib, Trans);
	}

	if (Object->Clip != Object->Bound)
	{
		for(vector<ObjectPtr>::iterator Sib = Object->Clip.begin(); Sib != Object->Clip.end(); Sib++)
		{
			Transform_Object(*Sib, Trans);
		}
	}

	/* NK 1998 added if */
	if (!Test_Flag(Object, UV_FLAG))
	{
		Transform_Textures(Object->Texture, Trans);
		Transform_Textures(Object->Interior_Texture, Trans);
	}

	if (Object->UV_Trans == NULL)
		Object->UV_Trans = Create_Transform();
	Compose_Transforms(Object->UV_Trans, Trans);

	if(Object->interior != NULL)
		Object->interior->Transform(Trans);

	Object->Transform(Trans);
}
Beispiel #4
0
void Transform_Parametric(OBJECT* Object, TRANSFORM* Trans)
{
	PARAMETRIC * Param = (PARAMETRIC *)Object;
	if (Param->Trans == NULL)
		Param->Trans = Create_Transform();
	Compose_Transforms(Param->Trans, Trans);
	Compute_Parametric_BBox(Param);
}
static void Transform_Cone(OBJECT *Object, TRANSFORM *Trans)
{
  CONE *Cone = (CONE *)Object;

  Compose_Transforms(Cone->Trans, Trans);

  Compute_Cone_BBox(Cone);
}
Beispiel #6
0
void IsoSurface::Transform(const TRANSFORM* tr)
{
    if(Trans == NULL)
        Trans = Create_Transform();

    Compose_Transforms(Trans, tr);

    Compute_BBox();
}
Beispiel #7
0
void Fractal::Transform(const TRANSFORM *tr)
{
    if(Trans == NULL)
        Trans = Create_Transform();

    Compose_Transforms(Trans, tr);

    Compute_BBox();
}
Beispiel #8
0
void Transform_Skysphere(SKYSPHERE *Skysphere, const TRANSFORM *Trans)
{
	if (Skysphere->Trans == NULL)
	{
		Skysphere->Trans = Create_Transform();
	}

	Compose_Transforms(Skysphere->Trans, Trans);
}
Beispiel #9
0
void Disc::Transform(const TRANSFORM *tr)
{
    MTransNormal(normal, normal, tr);

    normal.normalize();

    Compose_Transforms(Trans, tr);

    /* Recalculate the bounds */

    Compute_BBox();
}
Beispiel #10
0
void Sphere::Transform(const TRANSFORM *tr)
{
    if(Trans == NULL)
    {
        Do_Ellipsoid = true;
        Trans = Create_Transform();
    }

    Compose_Transforms(Trans, tr);

    Compute_BBox();
}
Beispiel #11
0
static void Transform_Box(OBJECT *Object, TRANSFORM *Trans)
{
  BOX *box = (BOX *)Object;

  if (box->Trans == NULL)
  {
    box->Trans = Create_Transform();
  }

  Compose_Transforms(box->Trans, Trans);

  Compute_Box_BBox(box);
}
Beispiel #12
0
static void Transform_IsoSurface(OBJECT* Object, TRANSFORM* Trans)
{
	ISOSURFACE * Isosrf = (ISOSURFACE *)Object;

	if(Isosrf->Trans == NULL)
	{
		Isosrf->Trans = Create_Transform();
	}

	Compose_Transforms(Isosrf->Trans, Trans);

	Compute_IsoSurface_BBox(Isosrf);
}
static void Transform_Plane(OBJECT *Object, TRANSFORM *Trans)
{
  PLANE *Plane = (PLANE  *) Object;

  if (Plane->Trans == NULL)
  {
    Plane->Trans = Create_Transform();
  }

  Compose_Transforms(Plane->Trans, Trans);

  Compute_Plane_BBox(Plane);
}
Beispiel #14
0
static void Transform_Polygon(OBJECT *Object, TRANSFORM *Trans)
{
  VECTOR N;
  POLYGON *Polyg = (POLYGON *)Object;

  Compose_Transforms(Polyg->Trans, Trans);

  Make_Vector(N, 0.0, 0.0, 1.0);
  MTransNormal(Polyg->S_Normal, N, Polyg->Trans);

  VNormalizeEq(Polyg->S_Normal);

  Compute_Polygon_BBox(Polyg);
}
Beispiel #15
0
static void Transform_Disc (OBJECT *Object, TRANSFORM *Trans)
{
  DISC *Disc = (DISC *)Object;

  MTransNormal(((DISC *)Object)->normal, ((DISC *)Object)->normal, Trans);

  VNormalize(((DISC *)Object)->normal, ((DISC *)Object)->normal);

  Compose_Transforms(Disc->Trans, Trans);

  /* Recalculate the bounds */

  Compute_Disc_BBox(Disc);
}
Beispiel #16
0
void Polygon::Transform(const TRANSFORM *tr)
{
    Vector3d N;

    if(Trans == NULL)
        Trans = Create_Transform();

    Compose_Transforms(Trans, tr);

    N = Vector3d(0.0, 0.0, 1.0);
    MTransNormal(S_Normal, N, Trans);

    S_Normal.normalize();

    Compute_BBox();
}
Beispiel #17
0
void Transform_Object (OBJECT *Object, TRANSFORM *Trans)
{
  OBJECT *Sib;

  if (Object == NULL)
  {
    return;
  }

  for (Sib = Object->Bound; Sib != NULL; Sib = Sib->Sibling)
  {
    Transform_Object(Sib, Trans);
  }

  if (Object->Clip != Object->Bound)
  {
    for (Sib = Object->Clip; Sib != NULL; Sib = Sib->Sibling)
    {
      Transform_Object(Sib, Trans);
    }
  }

  /* NK 1998 added if */
  if (!Test_Flag(Object, UV_FLAG))
  {
    Transform_Textures(Object->Texture, Trans);
    Transform_Textures(Object->Interior_Texture, Trans);
  }

	if (Object->UV_Trans == NULL)
		Object->UV_Trans = Create_Transform();
	Compose_Transforms(Object->UV_Trans, Trans);

  Transform_Interior(Object->Interior, Trans);

  Transform(Object,Trans);
}
Beispiel #18
0
void Superellipsoid::Transform(const TRANSFORM *tr)
{
    Compose_Transforms(Trans, tr);

    Compute_BBox();
}
Beispiel #19
0
void Cone::Transform(const TRANSFORM *tr)
{
    Compose_Transforms(Trans, tr);

    Compute_BBox();
}