geosoft.gxpy.geometry submodule¶
Spatial geometric objects.
Classes: |
|
---|
Note
Regression tests provide usage examples: geometry tests
-
class
Geometry
(coordinate_system=None, name=None, gxobj=None)¶ Bases:
object
Geometry base class for all geometries and spatial objects in Geosoft.
Parameters: - coordinate_system –
geosoft.gxpy.coordinate_system.Coordinate_system
instance. - name – instance name string
- gxobj – optional gxapi instance that can satisfy get_ipj() and/or get_extent()
Properties: Geometry.name
name for the geometry Geometry.coordinate_system
spatial coordinate system of the x, y, z locations Geometry.extent
spatial extent as a Point2
Geometry.extent_xyz
(min_x, min_y, min_z, max_x, max_y, max_z) Geometry.extent_xy
(min_x, min_y, max_x, max_y) Geometry.dimension
(dx, dy, dz) dimension Geometry.dimension_xy
(dx, dy) dimension Geometry.centroid
center point as a Point
Geometry.centroid_xyz
(x, y, z) location of the object center Geometry.centroid_xy
(x, y) center New in version 9.2.
-
centroid_xy
¶ Horizontal centroid as a tuple (x, y).
-
centroid_xyz
¶ Horizontal centroid as a tuple (x, y, z).
-
coordinate_system
¶ geosoft.gxpy.coordinate_system.Coordinate_system
instance or None. Can be set.
-
dimension
¶ Object dimensions as tuple (dx, dy, dz)
-
dimension_xy
¶ Horizontal dimension as a tuple (dx, dy).
-
extent_maximum_xy
¶ Maximum horizontal extent as tuple (max_x, max_y).
-
extent_maximum_xyz
¶ Maximum geometry extent as tuple (x, y, z).
-
extent_minimum_xy
¶ Minimum horizontal extent as tuple (min_x, min_y).
-
extent_minimum_xyz
¶ Minimum geometry extent as tuple (x, y, z).
-
extent_xy
¶ Horizontal extent as a tuple (min_x, min_y, max_x, max_y).
-
extent_xyz
¶ Object extent as a tuple (xmin, ymin, zmin, xmax, ymax, zmax).
-
gxobj
¶ An associated gxapi object, or None.
-
name
¶ Spatial object name.
- coordinate_system –
-
exception
GeometryException
¶ Bases:
Exception
Exceptions from
geosoft.gxpy.geometry
.
-
class
Mesh
(mesh, coordinate_system=None, name=None, **kwargs)¶ Bases:
geosoft.gxpy.geometry.Geometry
,collections.abc.Sequence
Mesh - set of triangular faces, which are indexes into verticies.
Parameters: - mesh – (faces, verticies) that define a trangulated mesh surface. See below.
- coordinate_system – coordinate system or None
- name – name for the mesh, defaule is ‘_mesh_’
- kwargs – passed to base class
Geometry
A mesh is a set of triangles, where each triangle has three indexes into a set of verticies. Verticies are defined as by a set of (x, y, z) locations. Meshes can be represented either as two arrays in the form (faces, verticies), or two sets of
geosoft.gxpy.vv.GXvv
instances in the form ((f1vv, f2vv, f3vv), (xvv, yvv, zvv)). In array form, each array is shaped (-1, 3), with faces being an integer array that references vertexes in the float vertex array.Operators supported: = + -, where ‘+’ can be used to combine two meshes or add a constant offset.
Iterating yields triangular faces as
PPoint
instances.Example: import numpy as np import geosoft.gxpy.geometry as gxgm import geosoft.gxpy.vv as gxvv # create from lists faces = [[0, 1, 2], [0, 2, 3], [3, 2, 4]] verticies = [[0, 0, 0], [5, 0, 0], [5, 5, 0], [0, 3, 5], [2.5, 2, 10]] mesh = gxgm.Mesh((faces, verticies)) # create from numpy arrays faces = np.array(faces, dtype=np.int32) verticies = np.array(verticies, dtype=np.float64) mesh = gxgm.Mesh((faces, verticies)) # create from vv f1vv, f2vv, f3vv = gxvv.vvset_from_np(faces) xvv, yvv, zvv = gxvv.vvset_from_np(verticies) mesh = gxgm.Mesh(((f1vv, f2vv, f3vv), (xvv, yvv, zvv)))
New in version 9.3.1.
-
faces
¶ Faces as an integer numpy array, shape (n_faces, 3).
-
faces_vv
()¶ Return faces in
geosoft.gxpy.vv.GXvv
tuple (f1vv, f2vv, f3vv).
-
length
¶ Number of faces
-
point_array
(unique=True)¶ Return numpy array of face corner locations.
Parameters: unique – True for limit to unique points, otherwise returns all points by unwinding each face. If unique the order will not be related to the faces. New in version 9.3.1.
-
verticies
¶ Verticies as a float numpy array, shape (n_verticies, 3).
-
verticies_vv
()¶ Return verticies in
geosoft.gxpy.vv.GXvv
tuple (xvv, yvv, zvv).
-
class
PPoint
(xyz, coordinate_system=None, z=0.0, name=None, **kwargs)¶ Bases:
geosoft.gxpy.geometry.Geometry
,collections.abc.Sequence
Poly-Point class. Basic instance arithmetic and equality testing is supported.
Parameters: - xyz – array-like: (p1, p2, ...), ((x, y), ...), ((x, y, z), ...) or (vv_x, vv_y, [vv_z]). vv data is resampled to match the first vv.
- coordinate_system – coordinate system or None
- z – constant z value for (x, y) data, ignored for (x, y, z) data
- kwargs – passed to base class
Geometry
Operators supported: = + - * /
New in version 9.2.
Changed in version 9.3.1: added coordinate_system parameter
-
classmethod
from_list
(xyzlist, z=0.0)¶ Deprecated since version 9.3:
PPoint
can create directly from a list
-
length
¶ number of points
-
make_xyz_vv
()¶ Return x, y and z as a set of
geosoft.gxpy.vv.GXvv
.Returns: (xvv, yvv, zvv) New in version 9.2.
-
x
¶ x array slice, can be set
-
xy
¶ (x, y) array slice, can be set
-
xyz
¶ xyz point array
-
y
¶ y array slice, can be set
-
z
¶ z array slice, can be set
-
class
Point
(p, coordinate_system=None, name=None, z=0.0, **kwargs)¶ Bases:
geosoft.gxpy.geometry.Geometry
,collections.abc.Sequence
Spatial location (x,y,z). Basic instance arithmetic and equality testing is supported.
Parameters: Iterates on [x, y, z]
Operators supported: = + - * /
New in version 9.2.
Changed in version 9.3.1: added coordinate_system parameter
-
extent
¶
-
x
¶ x value, can be set
-
xy
¶ (x, y), can be set
-
xyz
¶ (x, y, z), can be set
-
y
¶ y value, can be set
-
z
¶ z value, can be set
-
-
class
Point2
(p, coordinate_system=None, name=None, z=0, **kwargs)¶ Bases:
geosoft.gxpy.geometry.Geometry
,collections.abc.Sequence
Two points, for a line, or a rectangle, or a cube. Basic instance arithmetic and equality testing is supported.
Parameters: - p –
Points in one of the following forms:
Point2
makes a copy in the required coordinate system(x, y [, z]) two points at the same location
((x, y [, z]), (x, y [, z]))
(x0, y0, x1, y1) implied z is 0
(x0, y0, z0, x1, y1, z1)
- coordinate_system – coordinate system or None
- z – implied z value when only (x, y) is passed
- kwargs – passed to base class
Geometry
Iterates on two points [p0, p1].
Operators supported: = + - * /
Second operand may be a
Point2
or aPoint
.New in version 9.2.
Changed in version 9.3.1: added coordinate_system parameter
-
extent
¶ Extent as (xmin, ymin, zmin, xmax, ymax, zmax)
-
x2
¶ (x0, x1), can be set
-
y2
¶ (y0, y1), can be set
-
z2
¶ (z0, z1), can be set
- p –
-
extent_union
(g1, g2)¶ Return the spatial union of two spatial objects.
Parameters: - g1 – extent (p0 < p1), returned extent will be in this coordinate system
- g2 – second object
Returns: Point2
instance in the coordinate system of g1New in version 9.3.1.
-
first_coordinate_system
(geo_objects)¶ Return the first found known coordinate system in the list
Parameters: geo_objects – objects as iterable Returns: valid coordinate system or None if none found New in version 9.3.1.