pw::Segment

Connector and Curve segment type

Derives From

pw::Object

Summary
pw::SegmentConnector and Curve segment type
Instance Actions
deleteThis action deletes the segment.
getPointCountThis action gets the number of control points of this curve segment.
getPointThis action gets the control point at the given index.
getPointsThis action gets all the control points.
setPointThis action sets the control point at the given index.
addPointThis action adds a control point to the end of the control points for this curve segment.
insertPointThis action inserts a control point before the given index.
removePointThis action removes the control point at the given index.
removeInteriorPointsThis action removes all of the interior control points.
getPositionThis action gets the position in the defining space of the segment at the given parameter, index, arc length, or constant value.
getXYZThis action gets the position of the segment in model space at the given parameter, index, arc length, constant value, or closest point.
getParameterThis action gets the parametric value of the segment at the given parameter, index, arc length, constant value, or closest point.
getTangentThis action gets the tangency vector on the segment at a location.
getLengthThis action gets the length of the portion of the segment from the beginning to the given parameter, index, arc length, constant value, or closest point.
getBayThis actions gets the bay of the segment contained by the given parameter, index, arc length, constant value, or closest point
getTotalLengthThis action gets the total length of the segment.
closestPointThis action gets the closest point on this segment to the given point or ray.
isClosedThis action checks if the segment is closed.
isPoleThis action checks if the segment is a pole.
getXYZsOfBayThis action gets a list of points between two control points of a segment suitable for rendering.

Instance Actions

delete

$segment delete

This action deletes the segment.  This is necessary if the segment has not been added to a pw::Curve or pw::Connector.  Calling delete on a segment after it has been added, will generate an error.

Parameters

This action has no parameters.

Returns

This action does not return anything.

getPointCount

$segment getPointCount

This action gets the number of control points of this curve segment.

Parameters

This action has no parameters.

Returns

This action returns the integer number of control points.

getPoint

$segment getPoint index

This action gets the control point at the given index.

Parameters

indexThis required parameter is the integer index of the point to get in the range [1, number of points].

Returns

This action returns the point at the given index.

getPoints

$segment getPoints

This action gets all the control points.

Parameters

This action has no parameters.

Returns

This action returns a list of points.

setPoint

$segment setPoint index point

This action sets the control point at the given index.

Parameters

indexThis required parameter is the integer index of the point to set in the range [1, number of points].
pointThis required parameter is the point to set.

Returns

This action does not return anything.

addPoint

$segment addPoint point

This action adds a control point to the end of the control points for this curve segment.

Parameters

pointThis required parameter is the point to add.

Returns

This action does not return anything.

insertPoint

$segment insertPoint index point

This action inserts a control point before the given index.

Parameters

indexThis required parameter is the integer index to insert the given point in the range [1, number of points + 1]
pointThis required parameter is the point to be inserted.

Returns

This action does not return anything.

removePoint

$segment removePoint index

This action removes the control point at the given index.

Parameters

indexThis required parameter is the index of the point to remove in the range [1, number of points].

Returns

This action does not return anything.

removeInteriorPoints

$segment removeInteriorPoints

This action removes all of the interior control points.

Parameters

This action has no parameters.

Returns

This action returns a boolean which is true if there were any points removed and false otherwise.

getPosition

$segment getPosition ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the position in the defining space of the segment at the given parameter, index, arc length, or constant value.

Parameters

-parameterThis optional flag indicates to get the position at a specified parametric value.  The value is a float parameter or a uv vector in the range [(0.0, 0.0), (1.0, 1.0)].  This is the default option.
-controlThis optional flag indicates to get the position at a control point.  The value is an integer index in the range [1, number of points].
-arcThis optional flag indicates to get the position at an arc length.  The value is the float normalized arc length from the start of the curve in the range [0.0, 1.0].
-XThis optional flag indicates to get the position at a constant X.  The value is the float constant X Cartesian coordinate value in the range (-infinity, +infinity).
-YThis optional flag indicates to get the position at a constant Y.  The value is the float constant Y Cartesian coordinate value in the range (-infinity, +infinity)
-ZThis optional flag indicates to get the position at a constant Z.  The value is the float constant Z Cartesian coordinate value in the range (-infinity, +infinity).
-closestThis optional flag indicates to get the closest position.  The value is an xyz vector, point, or grid coord.
valueThis required parameter is the value at which to get the position.

Returns

This action returns a point at the position on the segment.  (It will be in the form “u v dbentity” if the segment is database constrained and otherwise in the form “X Y Z”.)

getXYZ

$segment getXYZ ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the position of the segment in model space at the given parameter, index, arc length, constant value, or closest point.

Parameters

-parameterThis optional flag indicates to get the xyz at a specified parametric value.  The value is a float parameter or a uv vector in the range [(0.0, 0.0), (1.0, 1.0)].  This is the default option.
-controlThis optional flag indicates to get the xyz at a control point.  The value is an integer index in the range [1, number of points].
-arcThis optional flag indicates to get the xyz at an arc length.  The value is the float normalized arc length from the start of the curve in the range [0.0, 1.0].
-XThis optional flag indicates to get the xyz at a constant X.  The value is the float constant X Cartesian coordinate value in the range (-infinity, +infinity).
-YThis optional flag indicates to get the xyz at a constant Y.  The value is the float constant Y Cartesian coordinate value in the range (-infinity, +infinity)
-ZThis optional flag indicates to get the xyz at a constant Z.  The value is the float constant Z Cartesian coordinate value in the range (-infinity, +infinity).
-closestThis optional flag indicates to get the closest xyz.  The value is an xyz vector, point, or grid coord.
valueThis required parameter is the value at which to get the xyz.

Returns

This action returns an XYZ vector.

getParameter

$segment getParameter ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the parametric value of the segment at the given parameter, index, arc length, constant value, or closest point.

Parameters

-parameterThis optional flag indicates to get the parameter at a specified parametric value.  The value is a float parameter or a uv vector in the range [(0.0, 0.0), (1.0, 1.0)].  This is the default option.
-controlThis optional flag indicates to get the parameter at a control point.  The value is an integer index in the range [1, number of points].
-arcThis optional flag indicates to get the parameter at an arc length.  The value is the float normalized arc length from the start of the curve in the range [0.0, 1.0].
-XThis optional flag indicates to get the parameter at a constant X.  The value is the float constant X Cartesian coordinate value in the range (-infinity, +infinity).
-YThis optional flag indicates to get the parameter at a constant Y.  The value is the float constant Y Cartesian coordinate value in the range (-infinity, +infinity)
-ZThis optional flag indicates to get the parameter at a constant Z.  The value is the float constant Z Cartesian coordinate value in the range (-infinity, +infinity).
-closestThis optional flag indicates to get the closest parameter.  The value is an parameter vector, point, or grid coord.
valueThis required parameter is the value at which to get the parameter.

Returns

This action returns the float parametric value at the specified location on the segment.

Information

The -parameter option only returns the given parameter, but is included for consistency with other commands

getTangent

$segment getTangent ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the tangency vector on the segment at a location.

Parameters

-parameterThis optional flag is notification to get the tangent vector at a parameter.  The value is a float with the range [0.0, 1.0], or a uv vector with u having the range [0.0, 1.0] and v ignored.
-controlThis optional flag denotes that value represents a control point index.  value is an integer index in the range [1, number of control points].  See <getControlPointCount>.
-arcThis optional flag designates value as the normalized arc length from the start of the segment.  value is a float in the range [0.0, 1.0].
-XThis optional flag causes the routine to calculate the tangent vector at the singular point on the segment at X = value.  An error is returned if there is not a unique point.
-YThis optional flag causes the routine to calculate the tangent vector at the singular point on the segment at Y = value.  An error is returned if there is not a unique point.
-ZThis optional flag causes the routine to calculate the tangent vector at the singular point on the segment at Z = value.  An error is returned if there is not a unique point.
-closestThis optional flag results in the routine calculating the tangent vector of the point on the segment closest to the specified valuevalue is an xyz vector, point, or grid coord.
valueThis required parameter is the float value at which to get the tangent vector.  Its interpretation is determined by the above flags.  The default mode is the -parameter flag.

Returns

This action returns a normalized XYZ vector representing the tangency direction.  The vector will be aligned with the parametric direction of the segment.

See Also

pw::Curve.getTangent

getLength

$segment getLength ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the length of the portion of the segment from the beginning to the given parameter, index, arc length, constant value, or closest point.

Parameters

-parameterThis optional parameter indicates to get the length to a parametric value; the value is a parameter or a uv parameter in the range [(0,0), (1,1)].  This is the default option.
-controlThis optional parameter indicates to get the length to a control point.  The value is an integer index in the range [1, number of points].
-arcThis optional parameter indicates to get the length to an arc length.  The value is the float normalized arc length from the start of the curve in the range [0.0, 1.0].
-XThis optional parameter indicates to get the length to a constant X.  The value is the float constant X Cartesian coordinate value in the range (-infinity, +infinity).
-YThis optional parameter indicates to get the length to a constant Y.  The value is the float constant Y Cartesian coordinate value in the range (-infinity, +infinity).
-ZThis optional parameter indicates to get the length to a constant Z.  The value is the float constant Z Cartesian coordinate value in the range (-infinity, +infinity).
-closestThis optional parameter indicates to get the length to the point on the segment that is closest to the specified point.  The value is a xyz vector, point, or grid coord.
valueThis required parameter is the float value at which to get the length.

Returns

This action returns the float length of the segment.

Information

The -arc option only converts from normalized to non-normalized length, but is included for consistency with other commands.

getBay

$segment getBay ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This actions gets the bay of the segment contained by the given parameter, index, arc length, constant value, or closest point

Parameters

-parameterThis optional parameter indicates to get the bay at a parametric value.  The value is a float parameter or a uv vector in the range [(0.0, 0.0), (1.0, 1.0)].  This is the default option.
-controlThis parameter indicates to get the bay at a control point.  The value is an integer index in the range [1, number of points].
-arcThis optional parameter indicates to get the bay at an arc length.  The value is the float normalized arc length from the start of the curve.
-XThis optional parameter indicates to get the bay at a constant X.  The value is the float constant X Cartesian coordinate value in the range (-infinity, +infinity).
-YThis optional parameter indicates to get the bay at a constant Y.  The value is the float constant Y Cartesian coordinate value in the range (-infinity, +infinity).
-ZThis optional parameter indicates to get the bay at a constant Z.  The value is the float constant Z Cartesian coordinate value in the range (-infinity, +infinity).
-closestThis optional parameter indicates to get the bay containing the closest point on the segment.  The value is a xyz vector, point, or grid coord.
valueThis required parameter is the float value at which to get the position.

Returns

This action returns the integer bay of the segment in the range [0, number of points].

Information

Special treatment is given to the ends of the segment.  If the given value specifies the beginning of the segment, a bay of 0 is returned, if the given value specifies the end of the segment, a bay of the number of points is returned.  For a segment with less than two control points, the result is always 0.

getTotalLength

$segment getTotalLength

This action gets the total length of the segment.

Parameters

This action has no parameters.

Returns

This action returns the float length in the range [0.0, +infinity).

closestPoint

$segment closestPoint ?-from fromVar? ?-distance distVar? ?-parameter paramVar? point ?dir?

This action gets the closest point on this segment to the given point or ray.

Parameters

-from fromVarThis optional parameter is a string variable name to receive the xyz vector of the given point or the point along the ray that is closest to this segment.
-distance distVarThis optional parameter is a string variable name to receive the float distance between the given point or ray and the point returned.
-parameter paramVarThis optional parameter is a string variable name to receive the float parameter of the segment where the closest point occurs in the range [0.0, 1.0].
pointThis required parameter is the point that is projected onto this segment.
dirThis optional parameter is a direction vector for finding the closest point from a ray emanating from the specified point.

Returns

This action returns an xyz vector.  If there is no closest point this action will return the origin.

isClosed

$segment isClosed

This action checks if the segment is closed.

Parameters

This action has no parameters.

Returns

This action returns a boolean, which is true if the segment is closed.

isPole

$segment isPole

This action checks if the segment is a pole.

Parameters

This action has no parameters.

Returns

This action returns a boolean, which is true if the segment is a pole.

getXYZsOfBay

$segment getXYZsOfBay index

This action gets a list of points between two control points of a segment suitable for rendering.

Parameters

indexThis required parameter is the integer index of the bay in the range [1, number of points-1].

Returns

This action returns a list of xyz vectors.

$segment delete
This action deletes the segment.
$segment getPointCount
This action gets the number of control points of this curve segment.
$segment getPoint index
This action gets the control point at the given index.
$segment getPoints
This action gets all the control points.
$segment setPoint index point
This action sets the control point at the given index.
$segment addPoint point
This action adds a control point to the end of the control points for this curve segment.
$segment insertPoint index point
This action inserts a control point before the given index.
$segment removePoint index
This action removes the control point at the given index.
$segment removeInteriorPoints
This action removes all of the interior control points.
$segment getPosition ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the position in the defining space of the segment at the given parameter, index, arc length, or constant value.
$segment getXYZ ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the position of the segment in model space at the given parameter, index, arc length, constant value, or closest point.
$segment getParameter ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the parametric value of the segment at the given parameter, index, arc length, constant value, or closest point.
$segment getTangent ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the tangency vector on the segment at a location.
$segment getLength ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the length of the portion of the segment from the beginning to the given parameter, index, arc length, constant value, or closest point.
$segment getBay ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This actions gets the bay of the segment contained by the given parameter, index, arc length, constant value, or closest point
$segment getTotalLength
This action gets the total length of the segment.
$segment closestPoint ?-from fromVar? ?-distance distVar? ?-parameter paramVar? point ?dir?
This action gets the closest point on this segment to the given point or ray.
$segment isClosed
This action checks if the segment is closed.
$segment isPole
This action checks if the segment is a pole.
$segment getXYZsOfBay index
This action gets a list of points between two control points of a segment suitable for rendering.
Base type for all glyph types
Database curve type
A connector is a computationally one-dimensional grid entity, defined in the parameter space of one or more end-connected curve segments.
An integer is a whole number.
A point is a position either in model space or database parameter space.
A boolean is represented as a 0 or 1, with 0 being false and 1 being true.
A float is a fractional number.
A vector is a list of float values.
A coord is a position in grid space.
$curve getTangent ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the tangency vector on the curve at a location.
A string is an array of characters.
Close