[SESI logo]

Houdini Development Toolkit - Version 6.5

Side Effects Software Inc. 2004

Geometry

Quadrics

Basic Functionality

Aside from metaballs , houdini supports three quadric primitives: circle, sphere, and tube. These primitives are very lightweight. They are defined primarily by a center point and a 3x3 transformation matrix which determines the size and the orientation of the quadric.

The common functionality of all quadrics is reflected in the base class, GEO_Quadric:

  • virtual const GEO_Vertex &getVertex(unsigned idx = 0) const
  • virtual GEO_Vertex &getVertex(unsigned idx = 0)
  • void setVertex(GEO_Point *ppt)
    Retrieve the vertex tied to the center point, or set it.

  • void getAxes(UT_Vector3 &x, UT_Vector3 &y, UT_Vector3 &z) const
  • void getXAxis(UT_Vector3 &x) const
  • void getYAxis(UT_Vector3 &y) const
  • void getZAxis(UT_Vector3 &z) const
  • void setAxes(const UT_Vector3 &x, const UT_Vector3 &y, const UT_Vector3 &z)
  • void setXAxis(const UT_Vector3 &x)
  • void setYAxis(const UT_Vector3 &y)
  • void setZAxis(const UT_Vector3 &z)
    Get or set the defining axes. The vectors are not normalized. Thus, the length of a radius or the height of a tube can be determined by computing the length of the appropriate vector (UT_Vector3::length()). Since the radii can have varying lengths, it is easy to create ellipses, ellipsoids, and cone sections.

  • const UT_Matrix3 &getTransform(void) const
  • void setTransform(const UT_Matrix3 &m)
    Get or set the rotation and scaling matrix, which determines the size and the orientation of the quadric.

  • const UT_Matrix3 &getTransform4(void) const
  • void setTransform4(const UT_Matrix3 &m)
    Get or set the complete, 4x4 transformation matrix, which includes the coordinates of the center point as well as the rotation and scaling components. By setting the 4x4 matrix you effectively change the UT_Vector4 coordinates of the center vertex.

  • Class Instantiation

    The GEO classes derived from GEO_Quadric - GEO_PrimCircle, GEO_PrimSphere, and GEO_PrimTube - are abstract, which means they cannot be instantiated. To build a quadric primitive, use the class static ::build() method defined in each one of GU_PrimCircle, GU_PrimSphere, and GU_PrimTube.

    The geometry can be generated as an actual quadric primitive, a polygon or mesh, a NURBS or a Bezier spline. The geometry type, quadric by default, can be passed into the ::build() method. The other parameters, including the 4x4 transformation matrix which contains the center, size, and orientation data, are passed into ::build() within a Parms structure.

    Here is an example of how to build a circle, a sphere, and a tube:

    GU_Detail gdp; // // Build a NURBS semi-circle of order 4: // GU_PrimCircle *circle; GU_PrimCircleParms circleparms; circleparms.gdp = &gdp; // geo detail to append to circleparms.divisions = 10; // number of divisions in curve circleparms.beginAngle = 0; // begin angle in radians circleparms.endAngle = 3.14; // end angle in radians circleparms.type = GU_CIRCLE_OPEN_ARC; circleparms.order = 4; // NURBS basis order circleparms.imperfect = 1; // not a rational curve circle = (GU_PrimCircle *)GU_PrimCircle::build(circleparms, GEOPRIMNURBCURVE); // // Build a primitive ellipsoid of X radius 2 and Z radius 3 at (1,1,1) : // GU_PrimSphere *sphere; GU_PrimSphereParms sphereparms; sphereparms.gdp = &gdp; // geo detail to append to sphereparms.xform.scale (2, 1, 3); // set the radii sphereparms.xform.translate(1, 1, 1); // set the center sphere = (GU_PrimSphere *)GU_PrimSphere::build(sphereparms, GEOPRIMSPHERE); // // Build an uncapped mesh tube with 2 rows, 10 columns, and a height of 0.5: // GU_PrimTube *tube; GU_PrimTubeParms tubeparms; GU_CapOptions nocaps; // no caps by default tubeparms.gdp = &gdp; // geo detail to append to tubeparms.rows = 2; // number of rows tubeparms.cols = 10; // number of columns tubeparms.type = GEO_PATCH_QUADS; tubeparms.xform.scale(1, 0.5, 1); // set the height tube = (GU_PrimTube *)GU_PrimTube::build(tubeparms, nocaps, GEOPRIMMESH); Always check the result of the ::build() method for failure. A primitive will not be created unless given valid parameters. A Bezier curve or surface, for example, is particularly strict about the number of CVs for a given basis order.

    NURBS and Bezier primitives are built with uniform bases in a [0,1] domain. The size and the parameterization of the domain can be changed using the specialized basis methods defined in GEO_Curve and GEO_TPSurf.


    Table of Contents
    Operators | Surface Operations | Particle Operations | Composite Operators | Channel Operators
    Material & Texture | Objects | Command and Expression | Render Output |
    Mantra Shaders | Utility Classes | Geometry Library | Image Library | Clip Library
    Customizing UI | Questions & Answers

    Copyright © 2004 Side Effects Software Inc.
    477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7