SphereSurfaceGen

Synopsis

The module SphereSurfaceGen generates a 2D sphere surface grid and mesh. Parameters allow modification of the angles, radius and resolution.


#ifdef MSDOS
  module SphereSurfaceGen <src_file="spsurf.c"> {
#else
  module SphereSurfaceGen <src_file="spsurf.c",
                           link_files="-lm"> {
#endif
    SphereSurfaceParams+IPort2 &SphereSurfaceParams<export=2>;
    int longdim => SphereSurfaceParams.longdim;
    int latdim => SphereSurfaceParams.latdim;
    double end_lat => SphereSurfaceParams.end_lat;
    double start_lat => SphereSurfaceParams.start_lat;
    double end_long => SphereSurfaceParams.end_long;
    double start_long => SphereSurfaceParams.start_long;
    double radius => SphereSurfaceParams.radius;
    int closedlong => SphereSurfaceParams.closedlong;
    int closedlat => SphereSurfaceParams.closedlat;
    omethod+notify_inst+req update(
      longdim+read+notify+req,
      latdim+read+notify+req,
      end_lat+read+notify+req,
      start_lat+read+notify+req,
      end_long+read+notify+req,
      start_long+read+notify+req,
      radius+read+notify+req,
      closedlong+read+notify+req,
      closedlat+read+notify+req,
      mesh+write
    ) = "sphere_surface_gen";
    Grid_Struct+Cells+Xform+OPort2 mesh<NEcolor1=65280,export=2> {
      ndim = 2;
    };
  };

Description

SphereSurfaceGen generates a 2D spherical surface grid and mesh based on the numerous input parameters. These parameters control the resolution of the resultant grid, specify the start and end angles for the longitude and latitude of the surface, and the sphere radius.

Additional options allow the two edges of the 2D surface to be closed: as the sphere wraps around the two edges will be connected in the mesh information, thus producing a continuous surface, as opposed to the standard Express sphere which simply aligns the two edges - producing a visible shading artefact.

Node data may also be mapped onto the grid, and the closed surface will keep the two edges of the mesh apart.

Typically the longitude will range between -180 and +180 degrees, and if the closed parameter is not selected, the two edges will not coincide. The resolution controls the angle between each grid line and the distance between the two edges will equal to this interval (for -180 to +180 longitude), thus producing a continuous surface.

Inputs

&SphereSurfaceGenParams

Reference to the parameter block, which contains real instances of:

longdim

Resolution of the sphere surface grid along the longitude axis.

latdim

Resolution of the sphere surface grid along the latitude axis.

start_long

Start angle in degrees for longitude (default is -180 degrees).

end_long

End angle in degrees for longitude (default is +180 degrees).

start_lat

Start angle in degrees for latitude (default is +90 degrees).

end_lat

Start angle in degrees for latitude (default is -90 degrees).

radius

Specify radius of the sphere surface (default is 1.0).

closedlong

Connect the two edges of the grid to make longitude continuous (by default this is ON).

closedlat

Connect the two edges of the grid to make latitude continuous (by default this is OFF).

Outputs

mesh

Output structured mesh of the sphere surface.

Utility Macros

The functional macro SphereSurface outputs the mesh as a normal field object and as a renderable data object. The functional macro SphereSurfaceData extends the functionality by allowing Node_Data to be mapped onto the Mesh, with output as both field and data object.

The user macros sphere_surface, sphere_surface_data and sphere_surface_lite combine the functional macros and the UI macro SphereSurfaceUI.

Example

Two example applications, SphereSurfaceEg1 and SphereSurfaceEg2, are provided which demonstrate the sphere_surface and sphere_surface_data macros respectively.

Files

iac_proj/spsurf/spsfmods.v contains the SphereSurfaceParams group and the SphereSurfaceGen module V definitions.

iac_proj/spsurf/spsfmacs.v contains the sphere_surface, sphere_surface_data and sphere_surface_lite User Macros, the SphereSurface and SphereSurfaceData Functional Macros and the SphereSurfaceUI UI Macro V definitions.

iac_proj/spsurf/spsfapps.v contains the SphereSurfaceEg1 and SphereSurfaceEg2 example application module V definitions.

Other Notes

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

Author

Paul G. Lever,
International AVS Centre

Modifications

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

SphereSurfaceParams, SphereSurface, SphereSurfaceData, sphere_surface, sphere_surface_data and sphere_surface_lite.

Sphere, Field_Sphere