Uses of Class
toxi.geom.Vec2D
Package
Description
-
Uses of Vec2D in toxi.geom
Modifier and TypeClassDescriptionclass
This class overridesEllipse
to define a 2D circle and provides several utility methods for it, including factory methods to construct circles from points.class
This class defines a 2D ellipse and provides several utility methods for it.class
A simple 2D ray datatypeModifier and TypeFieldDescriptionLine2D.a
Triangle2D.a
Line2D.b
Triangle2D.b
Triangle2D.c
Triangle2D.centroid
Vec2D[]
Spline2D.coeffA
Vec2D[]
Spline2D.delta
Modifier and TypeMethodDescriptionfinal Vec2D
Vec2D.abs()
ReadonlyVec2D.add
(float a, float b) Adds vector {a,b,c} and returns result as new vector.ReadonlyVec2D.add
(ReadonlyVec2D v) Add vector v and returns result as new vector.final Vec2D
Vec2D.add
(float a, float b) Vec2D.add
(ReadonlyVec2D v) final Vec2D
final Vec2D
Vec2D.addSelf
(float a, float b) Adds vector {a,b,c} and overrides coordinates with result.final Vec2D
Adds vector v and overrides coordinates with result.final Vec2D
Vec2D.clear()
Sets all vector components to 0.Line2D.closestPointTo
(ReadonlyVec2D p) Computes the closest point on this line to the point given.Triangle2D.computeCentroid()
static Vec2D
BezierCurve2D.computePointInSegment
(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t) static Vec2D
BezierCurve2D.computeTangentInSegment
(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t) Constraints this vector to the perimeter of the given polygon.Forcefully fits the vector in the given rectangle.Forcefully fits the vector in the given rectangle defined by the points.ReadonlyVec2D.copy()
final Vec2D
Vec2D.copy()
final Vec2D
Vec2D.floor()
Replaces the vector components with integer values of their current valuesfinal Vec2D
Vec2D.frac()
Replaces the vector components with the fractional part of their current valuesTriangle2D.fromBarycentric
(ReadonlyVec3D p) static final Vec2D
Vec2D.fromTheta
(float theta) Creates a new vector from the given angle in the XY plane.LineStrip2D.get
(int i) Returns the vertex at the given index.Polygon2D.get
(int i) Returns the vertex at the given index.ReadonlyVec2D.getAbs()
final Vec2D
Vec2D.getAbs()
Rect.getBottomLeft()
final Vec2D
Rect.getBottomRight()
ReadonlyVec2D.getCartesian()
Converts the vector from polar to Cartesian space.Vec2D.getCartesian()
LineStrip2D.getCentroid()
Polygon2D.getCentroid()
Computes the polygon's centre of mass.final Vec2D
Rect.getCentroid()
Returns the centroid of the rectangle.Polygon2D.getClosestPointTo
(ReadonlyVec2D p) Triangle2D.getClosestPointTo
(ReadonlyVec2D p) Finds and returns the closest point on any of the triangle edges to the point given.Polygon2D.getClosestVertexTo
(ReadonlyVec2D p) ReadonlyVec2D.getConstrained
(Rect r) Creates a copy of the vector which forcefully fits in the given rectangle.final Vec2D
Vec2D.getConstrained
(Polygon2D poly) final Vec2D
Vec2D.getConstrained
(Rect r) final Vec2D
Rect.getDimensions()
Returns a vector containing the width and height of the rectangle.Line2D.getDirection()
Ray2D.getDirection()
Returns a copy of the ray's direction vector.ReadonlyVec2D.getFloored()
Creates a new vector whose components are the integer value of their current valuesfinal Vec2D
Vec2D.getFloored()
Vec2D[]
Ellipse.getFoci()
ReadonlyVec2D.getFrac()
Creates a new vector whose components are the fractional part of their current valuesfinal Vec2D
Vec2D.getFrac()
ReadonlyVec2D.getInverted()
Scales vector uniformly by factor -1 ( v = -v )final Vec2D
Vec2D.getInverted()
ReadonlyVec2D.getLimited
(float lim) Creates a copy of the vector with its magnitude limited to the length givenfinal Vec2D
Vec2D.getLimited
(float lim) Produces a new vector with its coordinates passed through the givenScaleMap
.Rect.getMappedPointInRect
(Vec2D p) Computes the normalized position of the given point within this rectangle, so that a point at the top-left corner becomes {0,0} and bottom-right {1,1}.Line2D.getMidPoint()
Line2D.getNormal()
ReadonlyVec2D.getNormalized()
Produces the normalized version as a new vectorfinal Vec2D
Vec2D.getNormalized()
ReadonlyVec2D.getNormalizedTo
(float len) Produces a new vector normalized to the given length.final Vec2D
Vec2D.getNormalizedTo
(float len) ReadonlyVec2D.getPerpendicular()
final Vec2D
Vec2D.getPerpendicular()
LineStrip2D.getPointAt
(float t) Computes point at position t, where t is the normalized position along the strip.Ray2D.getPointAtDistance
(float dist) ReadonlyVec2D.getPolar()
Converts the current vector into polar coordinates.Vec2D.getPolar()
Line2D.LineIntersection.getPos()
Returns copy of intersection point.Ellipse.getRadii()
Ellipse.getRandomPoint()
Creates a random point within the ellipse using aBiasedFloatRange
to create a more uniform distribution.Polygon2D.getRandomPoint()
Creates a random point within the polygon.Rect.getRandomPoint()
Creates a random point within the rectangle.Shape2D.getRandomPoint()
Computes a random point within the shape's perimeter.Triangle2D.getRandomPoint()
Creates a random point within the triangle using barycentric coordinates.ReadonlyVec2D.getReciprocal()
final Vec2D
Vec2D.getReciprocal()
ReadonlyVec2D.getReflected
(ReadonlyVec2D normal) final Vec2D
Vec2D.getReflected
(ReadonlyVec2D normal) ReadonlyVec2D.getRotated
(float theta) Creates a new vector rotated by the given angle around the Z axis.final Vec2D
Vec2D.getRotated
(float theta) ReadonlyVec2D.getRoundedTo
(float prec) Creates a new vector with its coordinates rounded to the given precision (grid alignment).Vec2D.getRoundedTo
(float prec) ReadonlyVec2D.getSignum()
Creates a new vector in which all components are replaced with the signum of their original values.Vec2D.getSignum()
Vec2D[]
Circle.getTangentPoints
(ReadonlyVec2D p) final Vec2D
Rect.getTopLeft()
Rect.getTopRight()
Rect.getUnmappedPointInRect
(Vec2D p) Inverse operation ofRect.getMappedPointInRect(Vec2D)
.Vec2D[]
Triangle2D.getVertexArray()
Vec2D[]
Triangle2D.getVertexArray
(Vec2D[] array, int offset) ReadonlyVec2D.interpolateTo
(ReadonlyVec2D v, float f) Interpolates the vector towards the given target vector, using linear interpolationReadonlyVec2D.interpolateTo
(ReadonlyVec2D v, float f, InterpolateStrategy s) Interpolates the vector towards the given target vector, using the givenInterpolateStrategy
Vec2D.interpolateTo
(ReadonlyVec2D v, float f) Vec2D.interpolateTo
(ReadonlyVec2D v, float f, InterpolateStrategy s) final Vec2D
Vec2D.interpolateTo
(Vec2D v, float f) Vec2D.interpolateTo
(Vec2D v, float f, InterpolateStrategy s) final Vec2D
Vec2D.interpolateToSelf
(ReadonlyVec2D v, float f) Interpolates the vector towards the given target vector, using linear interpolationVec2D.interpolateToSelf
(ReadonlyVec2D v, float f, InterpolateStrategy s) Interpolates the vector towards the given target vector, using the givenInterpolateStrategy
Vec2D[]
Circle.intersectsCircle
(Circle c) final Vec2D
Vec2D.invert()
Scales vector uniformly by factor -1 ( v = -v ), overrides coordinates with resultfinal Vec2D
Vec2D.jitter
(float j) final Vec2D
Vec2D.jitter
(float jx, float jy) Adds random jitter to the vector in the range -j ...final Vec2D
final Vec2D
final Vec2D
final Vec2D
final Vec2D
Vec2D.limit
(float lim) Limits the vector's magnitude to the length givenReadonlyVec2D.max
(ReadonlyVec2D v) Constructs a new vector consisting of the largest components of both vectors.final Vec2D
Vec2D.max
(ReadonlyVec2D v) static final Vec2D
Vec2D.max
(ReadonlyVec2D a, ReadonlyVec2D b) Constructs a new vector consisting of the largest components of both vectors.final Vec2D
Vec2D.maxSelf
(ReadonlyVec2D v) Adjusts the vector components to the maximum values of both vectorsReadonlyVec2D.min
(ReadonlyVec2D v) Constructs a new vector consisting of the smallest components of both vectors.final Vec2D
Vec2D.min
(ReadonlyVec2D v) static final Vec2D
Vec2D.min
(ReadonlyVec2D a, ReadonlyVec2D b) Constructs a new vector consisting of the smallest components of both vectors.final Vec2D
Vec2D.minSelf
(ReadonlyVec2D v) Adjusts the vector components to the minimum values of both vectorsfinal Vec2D
Vec2D.normalize()
Normalizes the vector so that its magnitude = 1final Vec2D
Vec2D.normalizeTo
(float len) Normalizes the vector to the given length.final Vec2D
Vec2D.perpendicular()
static final Vec2D
Vec2D.randomVector()
Static factory method.static final Vec2D
Vec2D.randomVector
(Random rnd) Static factory method.final Vec2D
Vec2D.reciprocal()
final Vec2D
Vec2D.reflect
(ReadonlyVec2D normal) final Vec2D
Vec2D.rotate
(float theta) Rotates the vector by the given angle around the Z axis.Vec2D.roundTo
(float prec) ReadonlyVec2D.scale
(float s) Scales vector uniformly and returns result as new vector.ReadonlyVec2D.scale
(float a, float b) Scales vector non-uniformly and returns result as new vector.ReadonlyVec2D.scale
(ReadonlyVec2D s) Scales vector non-uniformly by vector v and returns result as new vectorfinal Vec2D
Vec2D.scale
(float s) final Vec2D
Vec2D.scale
(float a, float b) final Vec2D
Vec2D.scale
(ReadonlyVec2D s) final Vec2D
final Vec2D
Vec2D.scaleSelf
(float s) Scales vector uniformly and overrides coordinates with resultfinal Vec2D
Vec2D.scaleSelf
(float a, float b) Scales vector non-uniformly by vector {a,b,c} and overrides coordinates with resultfinal Vec2D
Scales vector non-uniformly by vector v and overrides coordinates with resultfinal Vec2D
Vec2D.set
(float x, float y) Overrides coordinates with the given valuesfinal Vec2D
Vec2D.set
(ReadonlyVec2D v) final Vec2D
Overrides coordinates with the ones of the given vectorfinal Vec2D
Vec2D.setComponent
(int id, float val) final Vec2D
Vec2D.setComponent
(Vec2D.Axis id, float val) Vec2D.setX
(float x) Vec2D.setY
(float y) final Vec2D
Vec2D.signum()
Replaces all vector components with the signum of their original values.final Vec2D
Vec2D.snapToAxis()
Rounds the vector to the closest major axis.ReadonlyVec2D.sub
(float a, float b) Subtracts vector {a,b,c} and returns result as new vector.ReadonlyVec2D.sub
(ReadonlyVec2D v) Subtracts vector v and returns result as new vector.final Vec2D
Vec2D.sub
(float a, float b) final Vec2D
Vec2D.sub
(ReadonlyVec2D v) final Vec2D
final Vec2D
Vec2D.subSelf
(float a, float b) Subtracts vector {a,b,c} and overrides coordinates with result.final Vec2D
Subtracts vector v and overrides coordinates with result.ReadonlyVec2D.tangentNormalOfEllipse
(Vec2D eO, Vec2D eR) Calculates the normal vector on the given ellipse in the direction of the current point.final Vec2D
Vec2D.tangentNormalOfEllipse
(Vec2D eO, Vec2D eR) ReadonlyVec3D.to2DXY()
Creates a new 2D vector of the XY components.final Vec2D
Vec3D.to2DXY()
ReadonlyVec3D.to2DXZ()
Creates a new 2D vector of the XZ components.final Vec2D
Vec3D.to2DXZ()
ReadonlyVec3D.to2DYZ()
Creates a new 2D vector of the YZ components.final Vec2D
Vec3D.to2DYZ()
final Vec2D
Vec2D.toCartesian()
final Vec2D
Vec2D.toPolar()
Modifier and TypeMethodDescriptionLineStrip2D.getDecimatedVertices
(float step) Computes a list of points along the spline which are uniformly separated by the given step distance.LineStrip2D.getDecimatedVertices
(float step, boolean doAddFinalVertex) Computes a list of points along the spline which are close to uniformly separated by the given step distance.Spline2D.getPointList()
LineStrip2D.getVertices()
PointQuadtree.itemsWithinRadius
(Vec2D p, float radius, List<Vec2D> results) PointQuadtree.itemsWithinRect
(Rect bounds, List<Vec2D> results) LineStrip2D.iterator()
Polygon2D.iterator()
Line2D.splitIntoSegments
(List<Vec2D> segments, float stepLength, boolean addFirst) Line2D.splitIntoSegments
(Vec2D a, Vec2D b, float stepLength, List<Vec2D> segments, boolean addFirst) Splits the line between A and B into segments of the given length, starting at point A.Modifier and TypeMethodDescriptionAdds a new vertex to the polygon (builder pattern).final Vec2D
final Vec2D
Adds vector v and overrides coordinates with result.Computes the perpendicular bisector of two points.static Vec2D
BezierCurve2D.computePointInSegment
(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t) static Vec2D
BezierCurve2D.computeTangentInSegment
(Vec2D a, Vec2D b, Vec2D c, Vec2D d, float t) Forcefully fits the vector in the given rectangle defined by the points.static Circle
Circle.from2Points
(Vec2D p1, Vec2D p2) Factory method to construct a circle which has the two given points lying on its perimeter.static Circle
Circle.from3Points
(Vec2D p1, Vec2D p2, Vec2D p3) Factory method to construct a circle which has the three given points lying on its perimeter.static Polygon2D
Polygon2D.fromBaseEdge
(Vec2D baseA, Vec2D baseB, int res) Constructs a new regular polygon from the given base line/edge.static final Rect
Rect.fromCenterExtent
(ReadonlyVec2D center, Vec2D extent) Factory method, constructs a new rectangle from a center point and extent vector.float
Ray2D.getDistanceToPoint
(Vec2D p) Calculates the distance between the given point and the infinite line coinciding with this ray.Rect.getMappedPointInRect
(Vec2D p) Computes the normalized position of the given point within this rectangle, so that a point at the top-left corner becomes {0,0} and bottom-right {1,1}.Rect.getUnmappedPointInRect
(Vec2D p) Inverse operation ofRect.getMappedPointInRect(Vec2D)
.Vec2D[]
Triangle2D.getVertexArray
(Vec2D[] array, int offset) boolean
Line2D.hasEndPoint
(Vec2D p) boolean
final Vec2D
Vec2D.interpolateTo
(Vec2D v, float f) Vec2D.interpolateTo
(Vec2D v, float f, InterpolateStrategy s) boolean
Rect.intersectsCircle
(Vec2D c, float r) static boolean
Triangle2D.isClockwise
(Vec2D a, Vec2D b, Vec2D c) boolean
boolean
ReadonlyVec2D.isInTriangle
(Vec2D a, Vec2D b, Vec2D c) Checks if point vector is inside the triangle created by the points a, b and c.boolean
Vec2D.isInTriangle
(Vec2D a, Vec2D b, Vec2D c) PointQuadtree.itemsWithinRadius
(Vec2D p, float radius, List<Vec2D> results) final Vec2D
final Vec2D
Line2D.offsetAndGrowBy
(float offset, float scale, Vec2D ref) boolean
Scales vector non-uniformly by vector v and returns result as new vectorfinal Vec2D
final Vec2D
Scales vector non-uniformly by vector v and overrides coordinates with resultvoid
final Vec2D
Overrides coordinates with the ones of the given vectorfinal Rect
Rect.setDimension
(Vec2D dim) final Rect
Rect.setPosition
(Vec2D pos) Overrides XY coordinates with the ones of the given 2D vector.Line2D.splitIntoSegments
(Vec2D a, Vec2D b, float stepLength, List<Vec2D> segments, boolean addFirst) Splits the line between A and B into segments of the given length, starting at point A.Subtracts vector v and returns result as new vector.final Vec2D
final Vec2D
Subtracts vector v and overrides coordinates with result.double
Sphere.surfaceDistanceBetween
(Vec2D p, Vec2D q) Computes the surface distance on this sphere between two points given as lon/lat coordinates.ReadonlyVec2D.tangentNormalOfEllipse
(Vec2D eO, Vec2D eR) Calculates the normal vector on the given ellipse in the direction of the current point.final Vec2D
Vec2D.tangentNormalOfEllipse
(Vec2D eO, Vec2D eR) boolean
Modifier and TypeMethodDescriptionstatic final Rect
Rect.getBoundingRect
(List<? extends Vec2D> points) Factory method, computes & returns the bounding rect for the given list of points.PointQuadtree.itemsWithinRadius
(Vec2D p, float radius, List<Vec2D> results) PointQuadtree.itemsWithinRect
(Rect bounds, List<Vec2D> results) static Circle
Circle.newBoundingCircle
(List<Vec2D> vertices) Spline2D.setPointList
(List<Vec2D> plist) Overrides the current control points with the given list.void
LineStrip2D.setVertices
(List<Vec2D> vertices) Line2D.splitIntoSegments
(List<Vec2D> segments, float stepLength, boolean addFirst) Line2D.splitIntoSegments
(Vec2D a, Vec2D b, float stepLength, List<Vec2D> segments, boolean addFirst) Splits the line between A and B into segments of the given length, starting at point A.ModifierConstructorDescriptionSpline2D
(Vec2D[] pointArray, BernsteinPolynomial b, float tightness) ModifierConstructorDescriptionBezierCurve2D
(List<Vec2D> points) LineStrip2D
(Collection<? extends Vec2D> vertices) Spline2D
(List<Vec2D> rawPoints, BernsteinPolynomial b, float tightness) -
Uses of Vec2D in toxi.geom.mesh
Modifier and TypeMethodDescriptionAdds the given 3 points as triangle face to the mesh and assigns the given texture coordinates to each vertex.void
-
Uses of Vec2D in toxi.geom.mesh2d
-
Uses of Vec2D in toxi.geom.nurbs
-
Uses of Vec2D in toxi.math
-
Uses of Vec2D in toxi.math.waves
-
Uses of Vec2D in toxi.newmesh
-
Uses of Vec2D in toxi.physics2d
Modifier and TypeClassDescriptionclass
An individual 3D particle for use by the VerletPhysics and VerletSpring classes.Modifier and TypeMethodDescriptionVerletParticle2D.getForce()
VerletParticle2D.getPreviousPosition()
Returns the particle's position at the most recent time step.VerletParticle2D.getVelocity()
Modifier and TypeMethodDescriptionVerletParticle2D.addVelocity
(Vec2D v) Attempts to find the spring element between the 2 particles suppliedVerletParticle2D.setPreviousPosition
(Vec2D p) ModifierConstructorDescriptionParticleString2D
(VerletPhysics2D physics, Vec2D pos, Vec2D step, int num, float mass, float strength) Creates a number of particles along a line and connects them into a string using springs.VerletPhysics2D
(Vec2D gravity, int numIterations, float drag, float timeStep) Initializes an Verlet engine instance with the passed in configuration. -
Uses of Vec2D in toxi.physics2d.behaviors
Modifier and TypeMethodDescriptionAttractionBehavior2D.getAttractor()
ConstantForceBehavior2D.getForce()
Modifier and TypeMethodDescriptionvoid
AttractionBehavior2D.setAttractor
(Vec2D attractor) void
void
Modifier and TypeMethodDescriptionvoid
AttractionBehavior2D.applyWithIndex
(SpatialIndex<Vec2D> spaceHash) void
ConstantForceBehavior2D.applyWithIndex
(SpatialIndex<Vec2D> spaceHash) void
ParticleBehavior2D.applyWithIndex
(SpatialIndex<Vec2D> index) ModifierConstructorDescriptionAttractionBehavior2D
(Vec2D attractor, float radius, float strength) AttractionBehavior2D
(Vec2D attractor, float radius, float strength, float jitter) ConstantForceBehavior2D
(Vec2D force) GravityBehavior2D
(Vec2D gravity) GravityBehavior2D
(Vec2D gravity, float timeStep) -
Uses of Vec2D in toxi.physics2d.constraints
ModifierConstructorDescriptionAngularConstraint
(Vec2D p, int theta) CircularConstraint
(Vec2D origin, float radius) RectConstraint
(Vec2D min, Vec2D max) -
Uses of Vec2D in toxi.processing
Modifier and TypeMethodDescriptionfinal void
final void
final void
Draws a 2D point at the given position.final void
final void
final void
Modifier and TypeMethodDescriptionfinal void
ToxiclibsSupport.lineStrip2D
(List<? extends Vec2D> points) Draws a 2D line strip using all points in the given list of vectors.final void
ToxiclibsSupport.lineStrip2D
(List<? extends Vec2D> points, float scale) final void
final void
final void
final void
ToxiclibsSupport.processVertices2D
(Iterator<? extends Vec2D> iterator, int shapeID, boolean closed) final void
ToxiclibsSupport.processVertices2D
(Iterator<? extends Vec2D> iterator, int shapeID, boolean closed, float scale)