scenic.core.vectors¶
Scenic vectors and vector fields.
Summary of Module Members¶
Functions


Decorator for vector operators that yield scalars. 

Decorator for methods that produce vectors. 

Decorator for vector operators that yield vectors. 
Classes
Distribution with a custom sampler given by an arbitrary function. 



A vector field defined by patching together several regions. 

A piecewiseconstant vector field defined over polygonal cells. 

A 2D vector, whose coordinates can be distributions. 

A distribution over Vectors. 

A vector field, providing a heading at every point. 

Vector version of MethodDistribution. 

Vector version of OperatorDistribution. 
Member Details¶
 class VectorDistribution(*args, **kwargs)[source]¶
Bases:
Distribution
A distribution over Vectors.
 class CustomVectorDistribution(*args, **kwargs)[source]¶
Bases:
VectorDistribution
Distribution with a custom sampler given by an arbitrary function.
 class VectorOperatorDistribution(*args, **kwargs)[source]¶
Bases:
VectorDistribution
Vector version of OperatorDistribution.
 class VectorMethodDistribution(*args, **kwargs)[source]¶
Bases:
VectorDistribution
Vector version of MethodDistribution.
 vectorDistributionMethod(method)[source]¶
Decorator for methods that produce vectors. See distributionMethod.
 class Vector(x, y)[source]¶

A 2D vector, whose coordinates can be distributions.
 class VectorField(name, value, minSteps=4, defaultStepSize=5)[source]¶
A vector field, providing a heading at every point.
 Parameters
name (str) – name for debugging.
value – function computing the heading at the given
Vector
.minSteps (int) – Minimum number of steps for
followFrom
; default 4.defaultStepSize (float) – Default step size for
followFrom
; default 5. This is an upper bound: more steps will be taken as needed to ensure that no single step is longer than this value, but if the distance to travel is small then the steps may be smaller.
 followFrom(pos, dist, steps=None, stepSize=None)[source]¶
Follow the field from a point for a given distance.
Uses the forward Euler approximation, covering the given distance with equalsize steps. The number of steps can be given manually, or computed automatically from a desired step size.
 Parameters
 static forUnionOf(regions)[source]¶
Creates a
PiecewiseVectorField
from the union of the given regions.If none of the regions have an orientation, returns
None
instead.
 class PolygonalVectorField(name, cells, headingFunction=None, defaultHeading=None)[source]¶
Bases:
VectorField
A piecewiseconstant vector field defined over polygonal cells.
 Parameters
name (str) – name for debugging.
cells – a sequence of cells, with each cell being a pair consisting of a Shapely geometry and a heading. If the heading is
None
, we call the given headingFunction for points in the cell instead.headingFunction – function computing the heading for points in cells without specified headings, if any (default
None
).defaultHeading – heading for points not contained in any cell (default
None
, meaning reject such points).
 class PiecewiseVectorField(name, regions, defaultHeading=None)[source]¶
Bases:
VectorField
A vector field defined by patching together several regions.
The heading at a point is determined by checking each region in turn to see if it has an orientation and contains the point, returning the corresponding heading if so. If we get through all the regions, then we return the defaultHeading, if any, and otherwise reject the scene.