EllipseCore

Synopsis

Generates a set of 3D ellipse objects, with both polyline ellipse edges and a surface linking the ellipses together.


   module EllipseCore <src_file="ellipse.cxx"> {
      cxxmethod+req+notify_inst update(
         .EllipseParams+req,
         .num_ellipses+read+notify+req,
         .num_points+read+notify+req,
         .aboutxc+read+notify+req,           
         .aboutyc+read+notify+req,           
         .x_dims+read+notify+req,
         .y_dims+read+notify+req,
         .ncoords+write,
         .nconn+write,
         .nquads+write,
         .line_conn+write,
         .quad_conn+write,
         .line_coords+write
      );
      EllipseParams+IPort2 &EllipseParams;
      int num_ellipses => .EllipseParams.num_ellipses;
      int num_points => .EllipseParams.num_points;
      float aboutxc => .EllipseParams.aboutxc;
      float aboutyc => .EllipseParams.aboutyc;
      float+IPort2 x_dims[num_ellipses];
      float+IPort2 y_dims[num_ellipses];
      int+OPort2 nconn;
      int+OPort2 ncoords;
      int+OPort2 nquads;
      int+OPort2 line_conn[nconn];
      float+OPort2 line_coords[ncoords][3];
      int+OPort2 quad_conn[nquads*4];
   };

Description

The EllipseCore module generates the primitive coordinate and connectivity arrays necessary to define a set of ellipses and a tubular connection between those ellipses. Each ellipse is created in the X-Y plane and offset a fixed distance from each other along the Z-axis. The major and minor axes of the generated ellipses are always aligned with the X and Y axes. A Quad mesh surface is also defined connecting adjacent ellipses into a elliptical tube object. The actual size and shape of each ellipse is defined by two arrays which specify the maximum size of the ellipse in the x-axis and y-axis. Four parameters allow control over the number of ellipses, the accuracy of the model and base position for the set of ellipses.

The Ellipse project is primarily designed to be an illustration of how geometric objects can be created with the AVS/Express Visualization system. The technique of generating coordinates and connectivity arrays using custom code and converting those into fields using Field Mapping modules has many applications. To assist in learning from this code both the V script code and the C++ source code are well documented. The code also contains a number of error checking methods that in some cases would not be necessary. However it is important that the programmer is aware of the existence of these problems. Practically this module could be used as the basis of a data visualization method that uses ellipses. Alternatively the basic method could be used to generate other geometric shapes.

Inputs

x_dims[] y_dims[]

Arrays specifying the x and y dimensions of each ellipse that is to be generated. These arrays have a type of float. In the supplied demonstration these arrays are generated by a random number generator. However in a practical situation these arrays are likely to be derived from data values.

&EllipseParams

Reference to the parameter block, which contains real instances of the parameters for the EllipseCore module.

num_ellipses

The number of ellipses that should be generated. The parameter is of type int. The x and y array inputs should have this many elements. The minimum number of ellipses is 2 as this many are needed to generate the connecting quad mesh. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &EllipseParams input.

num_points

The number of coordinates that should be generated per ellipse. The parameter is of type int. The minimum number of points is 4. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &EllipseParams input.

aboutxc aboutyc

The coordinates of the centre point of the stack of ellipses. The parameters are of type float. If the coordinates are non-zero than the ellipses will all be offset horizontally from the origin. Normally the value of this parameter is found by referring to the parameter block, which is referenced by the &EllipseParams input.

Outputs

ncoords line_coords[ncoords][3]

ncoords is an int variable that specifies the total number of coordinate values that have been generated. line_coords is a float array that contains the actual coordinates generated by the EllipseCore module.

nconn line_conn[nconn]

nconn is an int variable that specifies the number of polyline connections that have been generated. line_conn is a int array that contains the actual polyline connectivity data generated by the EllipseCore module. This data and the ellipse coordinates are passed to a polyline_mesh module in the Ellipse macro. This generates a usable polyline mesh that can be displayed.

nquads quad_conn[nquads*4]

nquads is an int variable that specifies the number of quadrilaterals that have been generated. quad_conn is a int array that contains the actual quadrilateral connectivity data generated by the EllipseCore module. This data and the ellipse coordinates are passed to a quad_mesh module in the Ellipse macro. This generates a usable quad mesh that can be displayed.

Utility Modules

The low-level EllipseCore module is used in the Functional Macro Ellipse. This Functional Macro is used within the User Macro ellipse. The low-level EllipseCore module also makes use of the EllipseParams common parameter block.

Example

An example application EllipseEg is provided that uses a set of random data to generate an elliptical tube. It shows how the size and shape of the ellipse can altered through a User Interface. The random data is generated using a set seed value hence the same data will be generated each time the example application is used.

Files

iac_proj/ellipse/ell_mods.v contains the V definitions of the EllipseCore module and the EllipseParams parameter blocks.

Other Notes

The low-level EllipseMods library containing the module EllipseCore does not specify a process. By default the express process will be used.

Author

Steve Larkin
Advanced Visual Systems, Ltd.
Hanworth Lane, Chertsey Surrey, UK
KT16 9JX

Andrew Dodd
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also

RandomNumCore, Ellipse, ellipse, EllipseEg, Mesh mappers library