Case Studies


SuperQuadric


Superquadrics are geometric shapes that generalize the properties of both ellipsoids and hyperboloids. They are defined by parametric equations and offer a flexible way to represent a wide range of complex 3D shapes. The term "superquadric" combines "super" (indicating the generalization of shapes) and "quadric" (referring to the family of shapes defined by quadratic equations).

A superquadric is typically defined by two sets of parameters: ε (epsilon) and θ (theta). Epsilon controls the shape of the superquadric, while theta controls its orientation. The specific parametric equations used to define a superquadric can vary, but they generally involve powers and trigonometric functions.

Superquadrics offer a rich variety of shapes that can exhibit properties such as sharp corners, edges, smooth curves, and concavities. By adjusting the parameters, you can create shapes ranging from spheres and ellipsoids to cubes, cylinders, and more exotic forms.

These shapes find applications in computer graphics, computer-aided design (CAD), robotics, simulation, and other fields where precise and versatile representations of 3D objects are required. Superquadrics are particularly useful when modeling complex objects with a combination of rounded and sharp features, allowing for a compact representation and efficient computations.

Superquadrics provide a powerful tool for representing and manipulating 3D shapes, enabling realistic rendering, physical simulation, collision detection, and other geometric operations. Their versatility and flexibility make them an essential concept in computer graphics and related disciplines.

This sample is based on article Barr, Alan H. (1981) Superquadrics and Angle-Preserving Transformations. IEEE Computer Graphics and Applications, 1 (1). pp. 11-23. ISSN 0272-1716 https://authors.library.caltech.edu/9756/

See also: https://en.wikipedia.org/wiki/Superquadrics

The provided code is a C# and VB.NET implementation for generating a superquadric shape and utilizing it to create a 3D model in a DXF file format. Here's an explanation of the main code:

  1. GenerateSuperQuadric() method:

    • Converts rotation angles (rxg, ryg, rzg) from degrees to radians.
    • Initializes variables and arrays to store the superquadric's vertices.
    • Iterates over r and p parameters to generate the vertices of the superquadric.
    • Applies rotations and translations to the vertices based on the rotation angles and a center point (Center).
    • Generates faces in the DXF format using the AddFace3D() method of the dxfReaderNETControl1 control.
  2. Superellipsoid(double eta, double omega) method:

    • Calculates the position of a vertex on the superellipsoid based on eta and omega parameters.
    • Uses the parameters a1, a2, a3, eps1, and eps2 to determine the shape and scale of the superellipsoid.
    • Returns the calculated vertex position as a Vector3 object.

Overall, the code generates a superquadric shape by dividing it into smaller sections (defined by r and p parameters) and calculating the vertex positions using the superellipsoid equation. The resulting vertices are then transformed using rotation angles and translations, and the faces are generated and added to a DXF file using the dxfReaderNETControl1 control.

It's worth noting that some variables and objects used in the code (such as rxg, ryg, rzg, a1, a2, a3, eps1, eps2, Center, color, dxfReaderNETControl1) are assumed to be defined elsewhere in the code or provided as inputs to the method.

The final visualization is rendered by DXFReader.NET component.


Download C# code

Download Visual Basic code

 


Warning!
All samples, data, places and images in this section are only for tutorial scope. They are fictitious and may not correspond to real cases.

Any similarities to actual persons or places is merely coincidental.

To evaluate all code samples you need to download and install the DXFReader.NET Compoonent first.