Exemplo n.º 1
0
PARAMETRIC* Create_Parametric()
{
	PARAMETRIC *New;

	New = (PARAMETRIC *)POV_MALLOC(sizeof(PARAMETRIC), "parametric");

	INIT_OBJECT_FIELDS(New, PARAMETRIC_OBJECT, &Parametric_Methods);

	Make_Vector(New->container.box.corner1, -1.0, -1.0, -1.0);
	Make_Vector(New->container.box.corner2, 1.0, 1.0, 1.0);

	Make_BBox(New->BBox, -1.0, -1.0, -1.0, 2.0, 2.0, 2.0);

	New->Trans = Create_Transform();

	New->Function[0] = NULL;
	New->Function[1] = NULL;
	New->Function[2] = NULL;
	New->accuracy = 0.001;
	New->max_gradient = 1;
	New->Inverted = false;
	New->PData = NULL;
	New->container_shape = 0;

	return New;
}
Exemplo n.º 2
0
SMOOTH_TRIANGLE *Create_Smooth_Triangle()
{
  SMOOTH_TRIANGLE *New;

  New = (SMOOTH_TRIANGLE *)POV_MALLOC(sizeof(SMOOTH_TRIANGLE), "smooth triangle");

  INIT_OBJECT_FIELDS(New,SMOOTH_TRIANGLE_OBJECT,&Smooth_Triangle_Methods)

  Make_Vector(New->Normal_Vector, 0.0, 1.0, 0.0);

  New->Distance = 0.0;

/* BEG ROSE
   The normal vectors are not matching the triangle, given by the points:
   END ROSE */
  Make_Vector(New->P1, 0.0, 0.0, 0.0);
  Make_Vector(New->P2, 1.0, 0.0, 0.0);
  Make_Vector(New->P3, 0.0, 1.0, 0.0);
  Make_Vector(New->N1, 0.0, 1.0, 0.0);
  Make_Vector(New->N2, 0.0, 1.0, 0.0);
  Make_Vector(New->N3, 0.0, 1.0, 0.0);

  /*
   * NOTE: Dominant_Axis and vAxis are computed when
   * Parse_Triangle calls Compute_Triangle.
   */

  return(New);
}
Exemplo n.º 3
0
TRIANGLE *Create_Triangle()
{
  TRIANGLE *New;

  New = (TRIANGLE *)POV_MALLOC(sizeof(TRIANGLE), "triangle");

  INIT_OBJECT_FIELDS(New,TRIANGLE_OBJECT,&Triangle_Methods)

  Make_Vector(New->Normal_Vector, 0.0, 1.0, 0.0);

  New->Distance = 0.0;

/* BEG ROSE
   this three points doesn't belong to the normal vector, created above:
   END ROSE */
  Make_Vector(New->P1, 0.0, 0.0, 0.0);
  Make_Vector(New->P2, 1.0, 0.0, 0.0);
  Make_Vector(New->P3, 0.0, 1.0, 0.0);

  /*
   * NOTE: Dominant_Axis is computed when Parse_Triangle calls
   * Compute_Triangle. vAxis is used only for smooth triangles.
   */

  return(New);
}
Exemplo n.º 4
0
CONE *Create_Cylinder()
{
  CONE *New;

  New = (CONE *)POV_MALLOC(sizeof(CONE), "cone");

  INIT_OBJECT_FIELDS(New, CONE_OBJECT, &Cone_Methods)

  Make_Vector(New->apex, 0.0, 0.0, 1.0);
  Make_Vector(New->base, 0.0, 0.0, 0.0);

  New->apex_radius = 1.0;
  New->base_radius = 1.0;
  New->dist        = 0.0;

  New->Trans = Create_Transform();

  Set_Flag(New, CYLINDER_FLAG); /* This is a cylinder. */
  Set_Flag(New, CLOSED_FLAG);   /* Has capped ends.    */

  /* Default bounds */

  Make_BBox(New->BBox, -1.0, -1.0, 0.0, 2.0, 2.0, 1.0);

  return (New);
}
Exemplo n.º 5
0
QUADRIC *Create_Quadric()
{
  QUADRIC *New;

  New = (QUADRIC *)POV_MALLOC(sizeof (QUADRIC), "quadric");

  INIT_OBJECT_FIELDS(New, QUADRIC_OBJECT, &Quadric_Methods)

  Make_Vector (New->Square_Terms, 1.0, 1.0, 1.0);
  Make_Vector (New->Mixed_Terms, 0.0, 0.0, 0.0);
  Make_Vector (New->Terms, 0.0, 0.0, 0.0);
  New->Constant = 1.0;
  New->Automatic_Bounds = false;

  return(New);
}
Exemplo n.º 6
0
PLANE *Create_Plane()
{
  PLANE *New;

  New = (PLANE *)POV_MALLOC(sizeof (PLANE), "plane");

  INIT_OBJECT_FIELDS(New,PLANE_OBJECT,&Plane_Methods)

  Make_Vector(New->Normal_Vector, 0.0, 1.0, 0.0);

  New ->Distance = 0.0;

  New->Trans = NULL;

  return(New);
}
Exemplo n.º 7
0
POLYGON *Create_Polygon()
{
  POLYGON *New;

  New = (POLYGON *)POV_MALLOC(sizeof(POLYGON), "polygon");

  INIT_OBJECT_FIELDS(New,POLYGON_OBJECT,&Polygon_Methods)

  New->Trans = Create_Transform();

  Make_Vector(New->S_Normal, 0.0, 0.0, 1.0);

  New->Data = NULL;

  return (New);
}
Exemplo n.º 8
0
BOX *Create_Box()
{
  BOX *New;

  New = (BOX *)POV_MALLOC(sizeof(BOX), "box");

  INIT_OBJECT_FIELDS(New, BOX_OBJECT, &Box_Methods)

  Make_Vector(New->bounds[0], -1.0, -1.0, -1.0);
  Make_Vector(New->bounds[1],  1.0,  1.0,  1.0);

  Make_BBox(New->BBox, -1.0, -1.0, -1.0, 2.0, 2.0, 2.0);

  New->Trans = NULL;

  return (New);
}
Exemplo n.º 9
0
ISOSURFACE* Create_IsoSurface()
{
	ISOSURFACE * New;

	New = (ISOSURFACE *)POV_MALLOC(sizeof(ISOSURFACE), "isosurface");

	INIT_OBJECT_FIELDS(New, ISOSURFACE_OBJECT, &IsoSurface_Methods)

	Make_Vector(New->container.box.corner1, -1.0, -1.0, -1.0);
	Make_Vector(New->container.box.corner2, 1.0, 1.0, 1.0);

	Make_BBox(New->BBox, -1.0, -1.0, -1.0, 2.0, 2.0, 2.0);

	New->Trans = Create_Transform();

	New->Function = NULL;
	New->accuracy = 0.001;
	New->max_trace = 1;

	New->cache = false;
	New->eval_param[0] = 0.0; // 1.1; // not necessary
	New->eval_param[1] = 0.0; // 1.4; // not necessary
	New->eval_param[2] = 0.0; // 0.99; // not necessary
	New->eval = false;
	New->closed = true;
	New->Inv3 = 1;
	New->container_shape = 0;

	New->max_gradient = 1.1;
	New->gradient = 0.0;
	New->threshold = 0.0;

	New->mginfo = (ISO_Max_Gradient *)POV_MALLOC(sizeof(ISO_Max_Gradient), "isosurface max_gradient info");
	New->mginfo->refcnt = 1;
	New->mginfo->max_gradient = 0.0;
	New->mginfo->gradient = 0.0; // not really necessary yet [trf]
	New->mginfo->eval_max = 0.0;
	New->mginfo->eval_cnt = 0.0;
	New->mginfo->eval_gradient_sum = 0.0;

	return New;
}
Exemplo n.º 10
0
BICUBIC_PATCH *Create_Bicubic_Patch()
{
  BICUBIC_PATCH *New;
  
  New = (BICUBIC_PATCH *)POV_MALLOC(sizeof (BICUBIC_PATCH), "bicubic patch");
  
  INIT_OBJECT_FIELDS(New, BICUBIC_PATCH_OBJECT, &Bicubic_Patch_Methods)
    
    New->Patch_Type = - 1;
  
  New->U_Steps = 0;
  New->V_Steps = 0;
  
  New->Flatness_Value = 0.0;
  New->accuracy = 0.01;
  
  New->Node_Tree = NULL;
  New->Weights = NULL;
  
  /*
   * NOTE: Control_Points[4][4] is initialized in Parse_Bicubic_Patch.
   * Bounding_Sphere_Center,Bounding_Sphere_Radius, Normal_Vector[], and
   * IPoint[] are initialized in Precompute_Patch_Values.
   */

  /* set the default uv-mapping coordinates */
  New->ST[0][U] = 0;
  New->ST[0][V] = 0;
  New->ST[1][U] = 1;
  New->ST[1][V] = 0;
  New->ST[2][U] = 1;
  New->ST[2][V] = 1;
  New->ST[3][U] = 0;
  New->ST[3][V] = 1;

  return (New);
}
Exemplo n.º 11
0
DISC *Create_Disc ()
{
  DISC *New;

  New = (DISC *)POV_MALLOC(sizeof (DISC), "disc");

  INIT_OBJECT_FIELDS(New, DISC_OBJECT, &Disc_Methods)

  Make_Vector (New->center, 0.0, 0.0, 0.0);
  Make_Vector (New->normal, 0.0, 0.0, 1.0);

  New->iradius2 = 0.0;
  New->oradius2 = 1.0;

  New->d = 0.0;

  New->Trans = Create_Transform();

  /* Default bounds */

  Make_BBox(New->BBox, -1.0, -1.0, -Small_Tolerance, 2.0,  2.0, 2.0 * Small_Tolerance);

  return (New);
}