Liking cljdoc? Tell your friends :D

quip.utils


backgroundclj

source

blackclj

source

blueclj

source

bold-fontclj

source

coarse-polys-collide?clj

(coarse-polys-collide? poly-a poly-b)
source

coarse-pos-in-poly?clj

(coarse-pos-in-poly? [x y] poly)

Predicate to determine if a point is possibly inside a polygon.

Checks if the point is contanied by the minimum rectangle containing the polygon. If the point is inside this rectangle we should use fine-poly-encloses to check properly.

Predicate to determine if a point is possibly inside a polygon.

Checks if the point is contanied by the minimum rectangle containing
the polygon. If the point is inside this rectangle we should use
`fine-poly-encloses` to check properly.
sourceraw docstring

darkenclj

(darken color)
source

default-fontclj

source

default-text-sizeclj

source

direction-vectorclj

(direction-vector r)

Calculate the unit direction vector based on the rotation angle.

Calculate the unit direction vector based on the rotation angle.
sourceraw docstring

equal-pos?clj

(equal-pos? pos-a pos-b)

Predicate to check if two positions are equal.

Predicate to check if two positions are equal.
sourceraw docstring

fillclj

source

fine-polys-collide?clj

(fine-polys-collide? poly-a poly-b)

Predicate to determine if two polygons overlap.

We first check if there are any points shared by the polygons, then we check if any of the lines intersect.

If no lines intersect it is still possible that one polygon is fully containing the other. In this case one polygon will contain all the points of the other. So we can just check if the first point of poly-a is contained in poly-b or vice versa.

Predicate to determine if two polygons overlap.

We first check if there are any points shared by the polygons, then
we check if any of the lines intersect.

If no lines intersect it is still possible that one polygon is fully
containing the other. In this case one polygon will contain all the
points of the other. So we can just check if the first point of
poly-a is contained in poly-b or vice versa.
sourceraw docstring

fine-pos-in-poly?clj

(fine-pos-in-poly? pos poly)

Uses ray casting to check if a polygon encloses a pos.

We construct a line starting at our point and count how many of the polygon lines it intersects, an odd number of intersections means the point is inside the polygon.

Our line should be infinite, but in practice any large number will suffice.

Uses ray casting to check if a polygon encloses a pos.

We construct a line starting at our point and count how many of the
polygon lines it intersects, an odd number of intersections means
the point is inside the polygon.

Our line should be infinite, but in practice any large number will
suffice.
sourceraw docstring

grayclj

source

greenclj

source

greyclj

source

italic-fontclj

source

large-text-sizeclj

source

lightenclj

(lighten color)
source

lines-intersect?clj

(lines-intersect? [[x1 y1] [x2 y2]] [[x3 y3] [x4 y4]])

Predicate to determine if two lines intersect.

line a: (x1, y1) -> (x2, y2) line b: (x3, y3) -> (x4, y4)

Predicate to determine if two lines intersect.

line a: (x1, y1) -> (x2, y2)
line b: (x3, y3) -> (x4, y4)
sourceraw docstring

magnitudeclj

(magnitude v)

Calculate the length of a vector.

Calculate the length of a vector.
sourceraw docstring

orthogonalsclj

(orthogonals [x y])

Calculate the two orthogonal vectors to a given 2D vector.

Y axis is inverted so this returns [90-degrees-right-vector 90-degrees-left-vector]

Calculate the two orthogonal vectors to a given 2D vector.

Y axis is inverted so this returns [90-degrees-right-vector
                                    90-degrees-left-vector]
sourceraw docstring

poly-linesclj

(poly-lines poly)

Construct the lines that make up a polygon from its points.

Construct the lines that make up a polygon from its points.
sourceraw docstring

poly-w-hclj

(poly-w-h poly)
source

polys-collide?clj

(polys-collide? poly-a poly-b)

Predicate to check if two polygons overlap.

The fine-polys-collide? predicate is expensive so we only do it if the cheaper coarse-polys-collide? says this is a possible collision.

Predicate to check if two polygons overlap.

The `fine-polys-collide?` predicate is expensive so we only do it if
the cheaper `coarse-polys-collide?` says this is a possible
collision.
sourceraw docstring

pos->rayclj

(pos->ray [x y])

Creates an arbitrarily long line starting at the specified pos.

When doing poly->point collision detection a point lying on a horizontal edge of a poly would cause a division by zero if we used a horizontal ray.

This would be handled, but would not count as a collision so we increment y to make it much less likely that the intersecting lines are parallel.

Creates an arbitrarily long line starting at the specified pos.

When doing poly->point collision detection a point lying on a
horizontal edge of a poly would cause a division by zero if we used
a horizontal ray.

This would be handled, but would not count as a collision so we
increment y to make it much less likely that the intersecting lines
are parallel.
sourceraw docstring

pos-in-poly?clj

(pos-in-poly? pos poly)

Predicate to check if a pos is inside a polygon.

The fine-pos-in-poly? predicate is expensive so we only do it if the cheaper coarse-pos-in-poly? says this is a possible collision.

Predicate to check if a pos is inside a polygon.

The `fine-pos-in-poly?` predicate is expensive so we only do it if
the cheaper `coarse-pos-in-poly?` says this is a possible
collision.
sourceraw docstring

pos-in-rect?clj

(pos-in-rect? [ax ay] [bx1 by1 bx2 by2])

Predicate to check if a position is inside a rectangle.

Predicate to check if a position is inside a rectangle.
sourceraw docstring

rects-overlap?clj

(rects-overlap? [ax1 ay1 ax2 ay2] [bx1 by1 bx2 by2])

Predicate to determine if two rectangles overlap.

Predicate to determine if two rectangles overlap.
sourceraw docstring

redclj

source

rotate-vectorclj

(rotate-vector [x y] r)

Rotate a vector about the origin by r degreees.

Rotate a vector about the origin by `r` degreees.
sourceraw docstring

rotation-angleclj

(rotation-angle [x y])

Calculate the rotation angle of a vector.

Calculate the rotation angle of a vector.
sourceraw docstring

small-text-sizeclj

source

strokeclj

source

title-text-sizeclj

source

unit-vectorclj

(unit-vector v)

Calculate the unit vector of a given 2D vector.

Calculate the unit vector of a given 2D vector.
sourceraw docstring

whiteclj

source

wrap-trans-rotclj

(wrap-trans-rot [x y] r f)

Perform a translation, a rotation, invoke the supplied function (probably drawing a sprite, then reset the transform matrix to the identity.

Perform a translation, a rotation, invoke the supplied
function (probably drawing a sprite, then reset the transform matrix
to the identity.
sourceraw docstring

zero-vector?clj

(zero-vector? v)

Predicate to check if a vector has length 0.

Predicate to check if a vector has length 0.
sourceraw docstring

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

× close