|
Scalar Field Visualization
This module provides visualization of artificial 3D shapes for data
(e.g. scalar field) visualization.
Input data may be provided as as discrete set of points that shall be encosed
by the shape.
For example:
import _ossimPlanet
import _surface
globe = _ossimPlanet.ossimPlanet()
# ... globe initialization
surface = _surface.surface(globe)
point = [
(0,0,0), (1,0,0), (0,1,0), (0,0,1),
(2,2,2), (3,2,2), (2,3,2), (2,2,3)]
surface.addAlphaShape(points, 0, (1, 0, 0, 0.7))
while not globe.renderDone():
globe.renderFrame()
Alternatively, the input data may be provided as a continuous surphace
function f(x,y,z).
For example:
import _ossimPlanet
import _surface
globe = _ossimPlanet.ossimPlanet()
# ... globe initialization
surface = _surface.surface(globe)
surface.addSurface(lambda x,y,z: x*x+y*y+z*z - 0.2, (1, 0, 0, 0.7))
while not globe.renderDone():
globe.renderFrame()
Class surface
-
class surface
- The surface provides 3D shape visualization based on CGAL library
functions.
surface instances have the following methods:
-
surface.setLocation(latitude, longitude, height)
The setLocation() method configures location of the center of the
shape.
The latitude and longitude parameters are measured in the geodetic
coordinates. The height is measured above terrain (AGL).
By default, the shape is located at zero coordinates and zero height.
-
surface.setScale(scale)
The setScale() method configures scale of the shape.
By default, the shape is not scaled (1.0).
-
surface.addSurface(function, color)
The addSurface() method inserts new artificial surface that is
determined by a surface function and a color.
The user provided surface function f(x,y,z) takes point coordinates and
determines if the point is inside, or outside the shape.
For a given (x,y,z)
- the f(x,y,z) return value < 0.0, if the point is inside the shape;
- the f(x,y,z) return value > 0.0, if the point is outside the shape.
For example, the following function determines a sphere of diameter 1.0:
lambda x,y,z: x*x+y*y+z*z - 1.0
The color parameter is a 4-tuple (red, green, blue, alpha). The alpha
value determines transparency of the shape.
-
surface.addAlphaShape(points, count, color)
The addAlphaShape() method inserts new artificial surface that is
constructed as a convex hull enclosing the given list of data points.
Each data point in the list is a 3-tuple (x,y,z) determining cartesian
coordinates of the point.
Alpha shape is a generalization of a convex hull, parametrized by alpha.
The alpha value can be interpreted as a maximal distance of neighbouring
points. The alpha shape thus becomes convex hull for infinite alpha.
There is no alpha parameter. This function calculates optimal alpha
value to get the given count of solid components.
- count == 1, creates a single solid component enclosing all given
data points;
- count > 1, creates the requested count of solid components;
- count == 0 (special case), creates the optimal number of components,
i.e. one or more, depending on the given data points.
The color parameter is a 4-tuple (red, green, blue, alpha). The alpha
value determines transparency of the shape.
Note: There is a terminology clash. The shape parameter alpha is nohow
related to the color alpha value.
|