Liking cljdoc? Tell your friends :D

org.nfrac.cljbox2d.vec2d

2D geometric point and vector helpers. All in terms of clojure vectors [x y]. Uses float precision for consistency with JBox2d.

2D geometric point and vector helpers.
All in terms of clojure vectors [x y].
Uses float precision for consistency with JBox2d.
raw docstring

absclj

(abs x)

Absolute value; avoids reflection from overloaded Math/abs

Absolute value; avoids reflection from overloaded Math/abs
sourceraw docstring

angle-intersectionclj

(angle-intersection xy0 ang0 xy1 ang1)

Point of intersection of two lines in the plane.

Point of intersection of two lines in the plane.
sourceraw docstring

angle-left?clj

(angle-left? angle)
source

angle-to-gradientclj

(angle-to-gradient ang)
source

angle-up?clj

(angle-up? angle)
source

horizontal-angle?clj

(horizontal-angle? ang)
(horizontal-angle? ang tol)

Is angle horizontal, within +/- 1.5 degrees by default.

Is angle horizontal, within +/- 1.5 degrees by default.
sourceraw docstring

in-pi-piclj

(in-pi-pi angle)

Returns the angle expressed in the range -pi to pi.

Returns the angle expressed in the range -pi to pi.
sourceraw docstring

interior-angleclj

(interior-angle [v0 v1 v2])

Interior angle of a triple of points using law of cosines: cosC = (a^2 + b^2 - c^2) / (2ab) where, in a triangle, angle C is opposite side c.

Interior angle of a triple of points using law of cosines:
  cosC = (a^2 + b^2 - c^2) / (2ab)
where, in a triangle, angle C is opposite side c.
sourceraw docstring

line-intersectionclj

(line-intersection [x0 y0] m0 [x1 y1] m1)

Point of intersection of two lines in the plane. First line passes through [x0 y0] with gradient m0. Other line passes through [x1 y1] with gradient m1. Gradient can be passed as nil for vertical lines.

Point of intersection of two lines in the plane.
First line passes through [x0 y0] with gradient m0.
Other line passes through [x1 y1] with gradient m1.
Gradient can be passed as nil for vertical lines.
sourceraw docstring

PIclj

Pi (180 degrees).

Pi (180 degrees).
sourceraw docstring

PI_2clj

Pi/2 (90 degrees).

Pi/2 (90 degrees).
sourceraw docstring

polar-xyclj

(polar-xy mag angle)

Convert polar coordinates (magnitude, angle) to cartesian coordinates (x, y).

Convert polar coordinates (magnitude, angle) to cartesian
coordinates (x, y).
sourceraw docstring

poly-edge-pointclj

(poly-edge-point vv angle origin-pt)

Finds point on edge of a convex polygon shape (given by counter-clockwise vertices) at a given angle from origin-pt.

Finds point on edge of a convex polygon shape (given by
counter-clockwise vertices) at a given `angle` from `origin-pt`.
sourceraw docstring

poly-flip-xclj

(poly-flip-x vv)
(poly-flip-x vv x0)

Flip polygon coordinates horizontally, by default around x=0.

Flip polygon coordinates horizontally, by default around x=0.
sourceraw docstring

poly-flip-yclj

(poly-flip-y vv)
(poly-flip-y vv y0)

Flip polygon coordinates vertically, by default around y=0.

Flip polygon coordinates vertically, by default around y=0.
sourceraw docstring

TWOPIclj

2 Pi (360 degrees).

2 Pi (360 degrees).
sourceraw docstring

v-addclj

(v-add v1 v2)

Add a 2d geometric vector to another.

Add a 2d geometric vector to another.
sourceraw docstring

v-angleclj

(v-angle [x y])

Angle of a 2d geometric vector in radians in range -pi to pi.

Angle of a 2d geometric vector in radians in range -pi to pi.
sourceraw docstring

v-distclj

(v-dist v1 v2)

Distance from one 2d point to another.

Distance from one 2d point to another.
sourceraw docstring

v-dotclj

(v-dot v1 v2)

Dot product of two vectors.

Dot product of two vectors.
sourceraw docstring

v-interpclj

(v-interp v1 v2 frac)

Find a point frac fraction of the way from v1 to v2 by linear interpolation.

Find a point `frac` fraction of the way from v1 to v2 by linear
interpolation.
sourceraw docstring

v-magclj

(v-mag [x y])

Magnitude of a 2d geometric vector

Magnitude of a 2d geometric vector
sourceraw docstring

v-scaleclj

(v-scale v)
(v-scale [x y] s)

Multiply elements of a 2d vector by a scalar; Default is to normalise to unit length.

Multiply elements of a 2d vector by a scalar;
Default is to normalise to unit length.
sourceraw docstring

v-subclj

(v-sub v1 v2)

Subtract a 2d geometric vector from another (v1 - v2).

Subtract a 2d geometric vector from another (v1 - v2).
sourceraw docstring

vertical-angle?clj

(vertical-angle? ang)
(vertical-angle? ang tol)

Is angle vertical, within +/- 1.5 degrees by default.

Is angle vertical, within +/- 1.5 degrees by default.
sourceraw docstring

x-valclj

source

y-valclj

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close