### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >

# 30. `curve` — Definition of curves in pyFormex.

This module defines classes and functions specialized for handling one-dimensional geometry in pyFormex. These may be straight lines, polylines, higher order curves and collections thereof. In general, the curves are 3D, but special cases may be created for handling plane curves.

`Classes defined in module curve`

class `curve.``Curve`

  Base class for curve type classes.

  This is a virtual class intended to be subclassed. It defines the common definitions for all curve types. The subclasses should at least define the following:

      sub_points(t,j)

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points`(t, j)

    Return the points at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `copy`()

    Return a deep copy of the object.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``PolyLine`(coords=[], control=None, closed=False)

  A class representing a series of straight line segments.

  coords is a (npts,3) shaped array of coordinates of the subsequent vertices of the polyline (or a compatible data object). If closed == True, the polyline is closed by connecting the last point to the first. This does not change the vertex data.

  The control parameter has the same meaning as coords and is added for symmetry with other Curve classes. If specified, it will override the coords argument.

  `close`()

    Close a PolyLine.

    If the PolyLine is already closed, it is returned unchanged. Else it is closed by adding a segment from the last to the first point (even if these are coincident).

    ..warning :: This method changes the PolyLine inplace.

  `open`()

    Open a closed PolyLine.

    If the PolyLine is closed, it is opened by removing the last segment. Else, it is returned unchanged.

    ..warning :: This method changes the PolyLine inplace.

    Use `split()` if you want to open the PolyLine without losing a segment.

  `toFormex`()

    Return the polyline as a Formex.

  `toMesh`()

    Convert the polyLine to a plex-2 Mesh.

    The returned Mesh is equivalent with the PolyLine.

  `sub_points`(t, j)

    Return the points at values t in part j

  `sub_points2`(t, j)

    Return the points at value,part pairs (t,j)

  `sub_directions`(t, j)

    Return the unit direction vectors at values t in part j.

  `vectors`()

    Return the vectors of each point to the next one.

    The vectors are returned as a Coords object. If the curve is not closed, the number of vectors returned is one less than the number of points.

  `directions`(return_doubles=False)

    Returns unit vectors in the direction of the next point.

    This directions are returned as a Coords object with the same number of elements as the point set.

    If two subsequent points are identical, the first one gets the direction of the previous segment. If more than two subsequent points are equal, an invalid direction (NaN) will result.

    If the curve is not closed, the last direction is set equal to the penultimate.

    If return_doubles is True, the return value is a tuple of the direction and an index of the points that are identical with their follower.

  `avgDirections`(return_doubles=False)

    Returns the average directions at points.

    For each point the returned direction is the average of the direction from the preceding point to the current, and the direction from the current to the next point.

    If the curve is open, the first and last direction are equal to the direction of the first, resp. last segment.

    Where two subsequent points are identical, the average directions are set equal to those of the segment ending in the first and the segment starting from the last.

  `lengths`()

    Return the length of the parts of the curve.

  `atLength`(div)

    Returns the parameter values for relative curve lengths div.

    `div` is a list of relative curve lengths (from 0.0 to 1.0). As a convenience, a single integer value may be specified, in which case the relative curve lengths are found by dividing the interval [0.0,1.0] in the specified number of subintervals.

    The function returns a list with the parameter values for the points at the specified relative lengths.

  `reverse`()

    Return the same curve with the parameter direction reversed.

  `split`(i)

    Split the curve at the point i.

    Returns a list of open PolyLines: one, if the PolyLine is closed or i is one of the endpoints of an open PolyLine, two in other cases.

  `cutWithPlane`(p, n, side='')

    Return the parts of the polyline at one or both sides of a plane.

    If side is ‘+’ or ‘-‘, return a list of PolyLines with the parts at the positive or negative side of the plane.

    For any other value, returns a tuple of two lists of PolyLines, the first one being the parts at the positive side.

    p is a point specified by 3 coordinates. n is the normal vector to a plane, specified by 3 components.

  `append`(PL, fuse=True, **kargs)

    Append another PolyLine to this one.

    Returns the concatenation of two open PolyLines. Closed PolyLines cannot be concatenated.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``Line`(coords)

  A Line is a PolyLine with exactly two points.

  Parameters:

  - coords: compatible with (2,3) shaped float array
  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `close`()

    Close a PolyLine.

    If the PolyLine is already closed, it is returned unchanged. Else it is closed by adding a segment from the last to the first point (even if these are coincident).

    ..warning :: This method changes the PolyLine inplace.

  `open`()

    Open a closed PolyLine.

    If the PolyLine is closed, it is opened by removing the last segment. Else, it is returned unchanged.

    ..warning :: This method changes the PolyLine inplace.

    Use `split()` if you want to open the PolyLine without losing a segment.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

  `toFormex`()

    Return the polyline as a Formex.

  `toMesh`()

    Convert the polyLine to a plex-2 Mesh.

    The returned Mesh is equivalent with the PolyLine.

  `sub_points`(t, j)

    Return the points at values t in part j

  `sub_points2`(t, j)

    Return the points at value,part pairs (t,j)

  `sub_directions`(t, j)

    Return the unit direction vectors at values t in part j.

  `vectors`()

    Return the vectors of each point to the next one.

    The vectors are returned as a Coords object. If the curve is not closed, the number of vectors returned is one less than the number of points.

  `directions`(return_doubles=False)

    Returns unit vectors in the direction of the next point.

    This directions are returned as a Coords object with the same number of elements as the point set.

    If two subsequent points are identical, the first one gets the direction of the previous segment. If more than two subsequent points are equal, an invalid direction (NaN) will result.

    If the curve is not closed, the last direction is set equal to the penultimate.

    If return_doubles is True, the return value is a tuple of the direction and an index of the points that are identical with their follower.

  `avgDirections`(return_doubles=False)

    Returns the average directions at points.

    For each point the returned direction is the average of the direction from the preceding point to the current, and the direction from the current to the next point.

    If the curve is open, the first and last direction are equal to the direction of the first, resp. last segment.

    Where two subsequent points are identical, the average directions are set equal to those of the segment ending in the first and the segment starting from the last.

  `lengths`()

    Return the length of the parts of the curve.

  `atLength`(div)

    Returns the parameter values for relative curve lengths div.

    `div` is a list of relative curve lengths (from 0.0 to 1.0). As a convenience, a single integer value may be specified, in which case the relative curve lengths are found by dividing the interval [0.0,1.0] in the specified number of subintervals.

    The function returns a list with the parameter values for the points at the specified relative lengths.

  `reverse`()

    Return the same curve with the parameter direction reversed.

  `split`(i)

    Split the curve at the point i.

    Returns a list of open PolyLines: one, if the PolyLine is closed or i is one of the endpoints of an open PolyLine, two in other cases.

  `cutWithPlane`(p, n, side='')

    Return the parts of the polyline at one or both sides of a plane.

    If side is ‘+’ or ‘-‘, return a list of PolyLines with the parts at the positive or negative side of the plane.

    For any other value, returns a tuple of two lists of PolyLines, the first one being the parts at the positive side.

    p is a point specified by 3 coordinates. n is the normal vector to a plane, specified by 3 components.

  `append`(PL, fuse=True, **kargs)

    Append another PolyLine to this one.

    Returns the concatenation of two open PolyLines. Closed PolyLines cannot be concatenated.

class `curve.``BezierSpline`(coords=None, deriv=None, curl=0.3333333333333333, control=None, closed=False, degree=3, endzerocurv=False)

  A class representing a Bezier spline curve of degree 1, 2 or 3.

  A Bezier spline of degree d is a continuous curve consisting of nparts successive parts, where each part is a Bezier curve of the same degree. Currently pyFormex can model linear, quadratic and cubic BezierSplines. A linear BezierSpline is equivalent to a PolyLine, which has more specialized methods than the BezierSpline, so it might be more sensible to use a PolyLine instead of the linear BezierSpline.

  A Bezier curve of degree d is determined by d+1 control points, of which the first and the last are on the curve, while the intermediate d-1 points are not. Since the end point of one part is the begin point of the next part, a BezierSpline is described by ncontrol=d*nparts+1 control points if the curve is open, or ncontrol=d*nparts if the curve is closed.

  The constructor provides different ways to initialize the full set of control points. In many cases the off-curve control points can be generated automatically.

  Parameters:

  - coords : array_like (npoints,3) The points that are on the curve. For an open curve, npoints=nparts+1, for a closed curve, npoints = nparts. If not specified, the on-curve points should be included in the control argument.

  - deriv : array_like (npoints,3) or (2,3) If specified, it gives the direction of the curve at all points or at the endpoints only for a shape (2,3) array. For points where the direction is left unspecified or where the specified direction contains a NaN value, the direction is calculated as the average direction of the two line segments ending in the point. This will also be used for points where the specified direction contains a value NaN. In the two endpoints of an open curve however, this average direction can not be calculated: the two control points in these parts are set coincident.

  - curl : float The curl parameter can be set to influence the curliness of the curve in between two subsequent points. A value curl=0.0 results in straight segments. The higher the value, the more the curve becomes curled.

  - control : array(nparts,2,3) or array(ncontrol,3) If coords was specified, this should be a (nparts,2,3) array with the intermediate control points, two for each part.

    If coords was not specified, this should be the full array of ncontrol control points for the curve. The number of points should be a multiple of 3 plus 1. If the curve is closed, the last point is equal to the first and does not need to a multiple of 3 is also allowed, in which case the first point will be appended as last.

    If not specified, the control points are generated automatically from the coords, deriv and curl arguments. If specified, they override these parameters.

  - closed : boolean If True, the curve will be continued from the last point back to the first to create a closed curve.

  - degree: int (1, 2 or 3) Specfies the degree of the curve. Default is 3.

  - endzerocurv : boolean or tuple of two booleans. Specifies the end conditions for an open curve. If True, the end curvature will be forced to zero. The default is to use maximal continuity of the curvature. The value may be set to a tuple of two values to specify different conditions for both ends. This argument is ignored for a closed curve.

  `pointsOn`()

    Return the points on the curve.

    This returns a Coords object of shape [nparts+1]. For a closed curve, the last point will be equal to the first.

  `pointsOff`()

    Return the points off the curve (the control points)

    This returns a Coords object of shape [nparts,ndegree-1], or an empty Coords if degree <= 1.

  `part`(j)

    Returns the points defining part j of the curve.

  `sub_points`(t, j)

    Return the points at values t in part j.

  `sub_directions`(t, j)

    Return the unit direction vectors at values t in part j.

  `sub_curvature`(t, j)

    Return the curvature at values t in part j.

  `length_intgrnd`(t, j)

    Return the arc length integrand at value t in part j.

  `lengths`()

    Return the length of the parts of the curve.

  `toMesh`()

    Convert the BezierSpline to a Mesh.

    For degrees 1 or 2, the returned Mesh is equivalent with the BezierSpline, and will have element type ‘line1’, resp. ‘line2’.

    For degree 3, the returned Mesh will currently be a quadratic approximation with element type ‘line2’.

  `approx_by_subdivision`(tol=0.001)

    Return a PolyLine approximation of the curve.

    tol is a tolerance value for the flatness of the curve. The flatness of each part is calculated as the maximum orthogonal distance of its intermediate control points from the straight segment through its end points.

    Parts for which the distance is larger than tol are subdivided using de Casteljau’s algorithm. The subdivision stops if all parts are sufficiently flat. The return value is a PolyLine connecting the end points of all parts.

  `extend`(extend=[1.0, 1.0])

    Extend the curve beyond its endpoints.

    This function will add a Bezier curve before the first part and/or after the last part by applying de Casteljau’s algorithm on this part.

  `reverse`()

    Return the same curve with the parameter direction reversed.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``CardinalSpline`(coords, tension=0.0, closed=False, endzerocurv=False)

  A class representing a cardinal spline.

  Create a natural spline through the given points.

  The Cardinal Spline with given tension is a Bezier Spline with curl :math: curl = ( 1 - tension) / 3 The separate class name is retained for compatibility and convenience. See CardinalSpline2 for a direct implementation (it misses the end intervals of the point set).

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

  `pointsOn`()

    Return the points on the curve.

    This returns a Coords object of shape [nparts+1]. For a closed curve, the last point will be equal to the first.

  `pointsOff`()

    Return the points off the curve (the control points)

    This returns a Coords object of shape [nparts,ndegree-1], or an empty Coords if degree <= 1.

  `part`(j)

    Returns the points defining part j of the curve.

  `sub_points`(t, j)

    Return the points at values t in part j.

  `sub_directions`(t, j)

    Return the unit direction vectors at values t in part j.

  `sub_curvature`(t, j)

    Return the curvature at values t in part j.

  `length_intgrnd`(t, j)

    Return the arc length integrand at value t in part j.

  `lengths`()

    Return the length of the parts of the curve.

  `toMesh`()

    Convert the BezierSpline to a Mesh.

    For degrees 1 or 2, the returned Mesh is equivalent with the BezierSpline, and will have element type ‘line1’, resp. ‘line2’.

    For degree 3, the returned Mesh will currently be a quadratic approximation with element type ‘line2’.

  `approx_by_subdivision`(tol=0.001)

    Return a PolyLine approximation of the curve.

    tol is a tolerance value for the flatness of the curve. The flatness of each part is calculated as the maximum orthogonal distance of its intermediate control points from the straight segment through its end points.

    Parts for which the distance is larger than tol are subdivided using de Casteljau’s algorithm. The subdivision stops if all parts are sufficiently flat. The return value is a PolyLine connecting the end points of all parts.

  `extend`(extend=[1.0, 1.0])

    Extend the curve beyond its endpoints.

    This function will add a Bezier curve before the first part and/or after the last part by applying de Casteljau’s algorithm on this part.

  `reverse`()

    Return the same curve with the parameter direction reversed.

class `curve.``CardinalSpline2`(coords, tension=0.0, closed=False)

  A class representing a cardinal spline.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``NaturalSpline`(coords, closed=False, endzerocurv=False)

  A class representing a natural spline.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``Arc3`(coords)

  A class representing a circular arc.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

class `curve.``Arc`(coords=None, center=None, radius=None, angles=None, angle_spec=0.017453292519943295)

  A class representing a circular arc.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

  `approx`(chordal=0.01, ndiv=None)

    Return a PolyLine approximation of the Arc.

    Approximates the Arc by a sequence of inscribed straight line segments.

    If ndiv is specified, the arc is divided in pecisely ndiv segments.

    If ndiv is not given, the number of segments is determined from the chordal distance tolerance. It will guarantee that the distance of any point of the arc to the chordal approximation is less or equal than chordal times the radius of the arc.

class `curve.``Spiral`(turns=2.0, nparts=100, rfunc=None)

  A class representing a spiral curve.

  `endPoints`()

    Return start and end points of the curve.

    Returns a Coords with two points, or None if the curve is closed.

  `sub_points`(t, j)

    Return the points at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_points_2`(t, j)

    Return the points at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `sub_directions`(t, j)

    Return the directions at values t in part j

    t can be an array of parameter values, j is a single segment number.

  `sub_directions_2`(t, j)

    Return the directions at values,parts given by zip(t,j)

    t and j can both be arrays, but should have the same length.

  `pointsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `addNoise`(*args, **kargs)

    Apply ‘addNoise’ transformation to the Geometry object.

    See `coords.Coords.addNoise()` for details.

  `affine`(*args, **kargs)

    Apply ‘affine’ transformation to the Geometry object.

    See `coords.Coords.affine()` for details.

  `align`(*args, **kargs)

    Apply ‘align’ transformation to the Geometry object.

    See `coords.Coords.align()` for details.

  `bump`(*args, **kargs)

    Apply ‘bump’ transformation to the Geometry object.

    See `coords.Coords.bump()` for details.

  `bump1`(*args, **kargs)

    Apply ‘bump1’ transformation to the Geometry object.

    See `coords.Coords.bump1()` for details.

  `bump2`(*args, **kargs)

    Apply ‘bump2’ transformation to the Geometry object.

    See `coords.Coords.bump2()` for details.

  `centered`(*args, **kargs)

    Apply ‘centered’ transformation to the Geometry object.

    See `coords.Coords.centered()` for details.

  `cylindrical`(*args, **kargs)

    Apply ‘cylindrical’ transformation to the Geometry object.

    See `coords.Coords.cylindrical()` for details.

  `egg`(*args, **kargs)

    Apply ‘egg’ transformation to the Geometry object.

    See `coords.Coords.egg()` for details.

  `flare`(*args, **kargs)

    Apply ‘flare’ transformation to the Geometry object.

    See `coords.Coords.flare()` for details.

  `hyperCylindrical`(*args, **kargs)

    Apply ‘hyperCylindrical’ transformation to the Geometry object.

    See `coords.Coords.hyperCylindrical()` for details.

  `isopar`(*args, **kargs)

    Apply ‘isopar’ transformation to the Geometry object.

    See `coords.Coords.isopar()` for details.

  `map`(*args, **kargs)

    Apply ‘map’ transformation to the Geometry object.

    See `coords.Coords.map()` for details.

  `map1`(*args, **kargs)

    Apply ‘map1’ transformation to the Geometry object.

    See `coords.Coords.map1()` for details.

  `mapd`(*args, **kargs)

    Apply ‘mapd’ transformation to the Geometry object.

    See `coords.Coords.mapd()` for details.

  `position`(*args, **kargs)

    Apply ‘position’ transformation to the Geometry object.

    See `coords.Coords.position()` for details.

  `projectOnCylinder`(*args, **kargs)

    Apply ‘projectOnCylinder’ transformation to the Geometry object.

    See `coords.Coords.projectOnCylinder()` for details.

  `projectOnPlane`(*args, **kargs)

    Apply ‘projectOnPlane’ transformation to the Geometry object.

    See `coords.Coords.projectOnPlane()` for details.

  `projectOnSphere`(*args, **kargs)

    Apply ‘projectOnSphere’ transformation to the Geometry object.

    See `coords.Coords.projectOnSphere()` for details.

  `reflect`(*args, **kargs)

    Apply ‘reflect’ transformation to the Geometry object.

    See `coords.Coords.reflect()` for details.

  `replace`(*args, **kargs)

    Apply ‘replace’ transformation to the Geometry object.

    See `coords.Coords.replace()` for details.

  `rollAxes`(*args, **kargs)

    Apply ‘rollAxes’ transformation to the Geometry object.

    See `coords.Coords.rollAxes()` for details.

  `rot`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `rotate`(*args, **kargs)

    Apply ‘rotate’ transformation to the Geometry object.

    See `coords.Coords.rotate()` for details.

  `scale`(*args, **kargs)

    Apply ‘scale’ transformation to the Geometry object.

    See `coords.Coords.scale()` for details.

  `shear`(*args, **kargs)

    Apply ‘shear’ transformation to the Geometry object.

    See `coords.Coords.shear()` for details.

  `spherical`(*args, **kargs)

    Apply ‘spherical’ transformation to the Geometry object.

    See `coords.Coords.spherical()` for details.

  `superSpherical`(*args, **kargs)

    Apply ‘superSpherical’ transformation to the Geometry object.

    See `coords.Coords.superSpherical()` for details.

  `swapAxes`(*args, **kargs)

    Apply ‘swapAxes’ transformation to the Geometry object.

    See `coords.Coords.swapAxes()` for details.

  `toCylindrical`(*args, **kargs)

    Apply ‘toCylindrical’ transformation to the Geometry object.

    See `coords.Coords.toCylindrical()` for details.

  `toSpherical`(*args, **kargs)

    Apply ‘toSpherical’ transformation to the Geometry object.

    See `coords.Coords.toSpherical()` for details.

  `transformCS`(*args, **kargs)

    Apply ‘transformCS’ transformation to the Geometry object.

    See `coords.Coords.transformCS()` for details.

  `translate`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `trl`(*args, **kargs)

    Apply ‘translate’ transformation to the Geometry object.

    See `coords.Coords.translate()` for details.

  `directionsAt`(t)

    Return the points at parameter values t.

    Parameter values are floating point values. Their integer part is interpreted as the curve segment number, and the decimal part goes from 0 to 1 over the segment.

  `subPoints`(div=10, extend=[0.0, 0.0])

    Return a sequence of points on the Curve.

    - div: int or a list of floats (usually in the range [0.,1.]) If div is an integer, a list of floats is constructed by dividing the range [0.,1.] into div equal parts. The list of floats then specifies a set of parameter values for which points at in each part are returned. The points are returned in a single Coords in order of the parts.

    The extend parameter allows to extend the curve beyond the endpoints. The normal parameter space of each part is [0.0 .. 1.0]. The extend parameter will add a curve with parameter space [-extend[0] .. 0.0] for the first part, and a curve with parameter space [1.0 .. 1 + extend[0]] for the last part. The parameter step in the extensions will be adjusted slightly so that the specified extension is a multiple of the step size. If the curve is closed, the extend parameter is disregarded.

  `copy`()

    Return a deep copy of the object.

  `length`()

    Return the total length of the curve.

    This is only available for curves that implement the ‘lengths’ method.

  `approx`(ndiv=None, ntot=None)

    Return a PolyLine approximation of the curve

    If no ntot is given, the curve is approximated by ndiv straight segments over each part of the curve. If ntot is given, the curve is approximated by ntot straight segments over the total curve. This is based on a first approximation with ndiv segments over each part.

  `resized`(size=1.0, tol=1e-05)

    Return a scaled copy of the Formex with given size in all directions.

    If a direction has zero size, it is not rescaled.

  `toFormex`(*args, **kargs)

    Convert a curve to a Formex.

    This creates a polyline approximation as a plex-2 Formex. This is mainly used for drawing curves that do not implement their own drawing routines.

    The method can be passed the same arguments as the approx method.

  `setProp`(p=None)

    Create or destroy the property array for the Formex.

    A property array is a rank-1 integer array with dimension equal to the number of elements in the Formex (first dimension of data). You can specify a single value or a list/array of integer values. If the number of passed values is less than the number of elements, they wil be repeated. If you give more, they will be ignored.

    If a value None is given, the properties are removed from the Formex.

  `write`(fil, sep=' ', mode='w')

    Write a Geometry to a .pgf file.

    If fil is a string, a file with that name is opened. Else fil should be an open file. The Geometry is then written to that file in a native format, using sep as separator between the coordinates. If fil is a string, the file is closed prior to returning.

`Functions defined in module curve`

`curve.``circle`()

  Create a spline approximation of a circle.

  The returned circle lies in the x,y plane, has its center at (0,0,0) and has a radius 1.

  In the current implementation it is approximated by a bezier spline with curl 0.375058 through 8 points.

`curve.``convertFormexToCurve`(self, closed=False)

  Convert a Formex to a Curve.

  The following Formices can be converted to a Curve: - plex 2 : to PolyLine - plex 3 : to BezierSpline with degree=2 - plex 4 : to BezierSpline

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >