Add docstrings to math

This commit is contained in:
oakes
2014-01-21 16:20:28 -05:00
parent 5f6a8985f8
commit b83924541a

View File

@@ -9,369 +9,451 @@
; static methods/fields ; static methods/fields
(defmacro geometry! (defmacro geometry!
"Calls a single method on [GeometryUtils](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/GeometryUtils.html)"
[k & options] [k & options]
`(~(u/static-symbol [:math :GeometryUtils k] u/key->camel) ~@options)) `(~(u/static-symbol [:math :GeometryUtils k] u/key->camel) ~@options))
(defmacro interpolation (defmacro interpolation
"Returns a static class in [Interpolation](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Interpolation.html)
(interpolation :bounce)"
[k] [k]
`~(symbol (str u/main-package ".math.Interpolation$" (u/key->pascal k)))) `~(symbol (str u/main-package ".math.Interpolation$" (u/key->pascal k))))
(defmacro intersector! (defmacro intersector!
"Calls a single method on [Intersector](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Intersector.html)
(intersector! :is-point-in-triangle 0 1 0 0 1 2 3 0)"
[k & options] [k & options]
`(~(u/static-symbol [:math :Intersector k] u/key->camel) ~@options)) `(~(u/static-symbol [:math :Intersector k] u/key->camel) ~@options))
(defmacro math! (defmacro math!
"Calls a single method on [MathUtils](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/MathUtils.html)
(math! :ceil 0.1)"
[k & options] [k & options]
`(~(u/static-symbol [:math :MathUtils k] u/key->camel) ~@options)) `(~(u/static-symbol [:math :MathUtils k] u/key->camel) ~@options))
(defmacro plane-side (defmacro plane-side
"Returns a static field in [Plane.PlaneSide](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Plane.PlaneSide.html)
(plane-side :back)"
[k] [k]
`~(symbol (str u/main-package ".math.Plane$PlaneSide/" (u/key->pascal k)))) `~(symbol (str u/main-package ".math.Plane$PlaneSide/" (u/key->pascal k))))
; bezier ; bezier
(defn bezier* (defn bezier*
"The function version of `bezier`"
([] ([]
(Bezier.)) (Bezier.))
([points] ([points]
(Bezier. (into-array points) 0 (count points)))) (Bezier. (into-array points) 0 (count points))))
(defmacro bezier (defmacro bezier
"Returns a [Bezier](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Bezier.html)"
[points & options] [points & options]
`(u/calls! ^Bezier (bezier* ~points) ~@options)) `(u/calls! ^Bezier (bezier* ~points) ~@options))
(defmacro bezier! (defmacro bezier!
"Calls a single method on a `bezier`"
[object k & options] [object k & options]
`(u/call! ^Bezier ~object ~k ~@options)) `(u/call! ^Bezier ~object ~k ~@options))
; bresenham2 ; bresenham2
(defn bresenham2* (defn bresenham2*
"The function version of `bresenham2`"
[] []
(Bresenham2.)) (Bresenham2.))
(defmacro bresenham2 (defmacro bresenham2
"Returns a [Bresenham2](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Bresenham2.html)"
[& options] [& options]
`(u/calls! ^Bresenham2 (bresenham2*) ~@options)) `(u/calls! ^Bresenham2 (bresenham2*) ~@options))
(defmacro bresenham2! (defmacro bresenham2!
"Calls a single method on a `bresenham2`"
[object k & options] [object k & options]
`(u/call! ^Bresenham2 ~object ~k ~@options)) `(u/call! ^Bresenham2 ~object ~k ~@options))
; b-spline ; b-spline
(defn b-spline* (defn b-spline*
"The function version of `b-spline`"
([] ([]
(BSpline.)) (BSpline.))
([points degree cont?] ([points degree cont?]
(BSpline. (into-array points) degree cont?))) (BSpline. (into-array points) degree cont?)))
(defmacro b-spline (defmacro b-spline
"Returns a [BSpline](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/BSpline.html)"
[points degree cont? & options] [points degree cont? & options]
`(u/calls! ^BSpline (b-spline* ~points ~degree ~cont?) ~@options)) `(u/calls! ^BSpline (b-spline* ~points ~degree ~cont?) ~@options))
(defmacro b-spline! (defmacro b-spline!
"Calls a single method on a `b-spline`"
[object k & options] [object k & options]
`(u/call! ^BSpline ~object ~k ~@options)) `(u/call! ^BSpline ~object ~k ~@options))
; catmull-rom-spline ; catmull-rom-spline
(defn catmull-rom-spline* (defn catmull-rom-spline*
"The function version of `catmull-rom-spline`"
([] ([]
(CatmullRomSpline.)) (CatmullRomSpline.))
([points cont?] ([points cont?]
(CatmullRomSpline. (into-array points) cont?))) (CatmullRomSpline. (into-array points) cont?)))
(defmacro catmull-rom-spline (defmacro catmull-rom-spline
"Returns a [CatmullRomSpline](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/CatmullRomSpline.html)"
[points cont? & options] [points cont? & options]
`(u/calls! ^CatmullRomSpline (catmull-rom-spline* ~points ~cont?) ~@options)) `(u/calls! ^CatmullRomSpline (catmull-rom-spline* ~points ~cont?) ~@options))
(defmacro catmull-rom-spline! (defmacro catmull-rom-spline!
"Calls a single method on a `catmull-rom-spline`"
[object k & options] [object k & options]
`(u/call! ^CatmullRomSpline ~object ~k ~@options)) `(u/call! ^CatmullRomSpline ~object ~k ~@options))
; circle ; circle
(defn circle* (defn circle*
"The function version of `circle`"
([] ([]
(Circle.)) (Circle.))
([x y radius] ([x y radius]
(Circle. x y radius))) (Circle. x y radius)))
(defmacro circle (defmacro circle
"Returns a [Circle](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Circle.html)"
[x y radius & options] [x y radius & options]
`(u/calls! ^Circle (circle* ~x ~y ~radius) ~@options)) `(u/calls! ^Circle (circle* ~x ~y ~radius) ~@options))
(defmacro circle! (defmacro circle!
"Calls a single method on a `circle`"
[object k & options] [object k & options]
`(u/call! ^Circle ~object ~k ~@options)) `(u/call! ^Circle ~object ~k ~@options))
; convex-hull ; convex-hull
(defn convex-hull* (defn convex-hull*
"The function version of `convex-hull`"
[] []
(ConvexHull.)) (ConvexHull.))
(defmacro convex-hull (defmacro convex-hull
"Returns a [ConvexHull](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/ConvexHull.html)"
[& options] [& options]
`(u/calls! ^ConvexHull (convex-hull*) ~@options)) `(u/calls! ^ConvexHull (convex-hull*) ~@options))
(defmacro convex-hull! (defmacro convex-hull!
"Calls a single method on a `convex-hull`"
[object k & options] [object k & options]
`(u/call! ^ConvexHull ~object ~k ~@options)) `(u/call! ^ConvexHull ~object ~k ~@options))
; delaunay-triangulator ; delaunay-triangulator
(defn delaunay-triangulator* (defn delaunay-triangulator*
"The function version of `delaunay-triangulator`"
[] []
(DelaunayTriangulator.)) (DelaunayTriangulator.))
(defmacro delaunay-triangulator (defmacro delaunay-triangulator
"Returns a [DelaunayTriangulator](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/DelaunayTriangulator.html)"
[& options] [& options]
`(u/calls! ^DelaunayTriangulator (delaunay-triangulator*) ~@options)) `(u/calls! ^DelaunayTriangulator (delaunay-triangulator*) ~@options))
(defmacro delaunay-triangulator! (defmacro delaunay-triangulator!
"Calls a single method on a `delaunay-triangulator`"
[object k & options] [object k & options]
`(u/call! ^DelaunayTriangulator ~object ~k ~@options)) `(u/call! ^DelaunayTriangulator ~object ~k ~@options))
; ear-clipping-triangulator ; ear-clipping-triangulator
(defn ear-clipping-triangulator* (defn ear-clipping-triangulator*
"The function version of `ear-clipping-triangulator`"
[] []
(EarClippingTriangulator.)) (EarClippingTriangulator.))
(defmacro ear-clipping-triangulator (defmacro ear-clipping-triangulator
"Returns an [EarClippingTriangulator](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/EarClippingTriangulator.html)"
[& options] [& options]
`(u/calls! ^EarClippingTriangulator (ear-clipping-triangulator*) ~@options)) `(u/calls! ^EarClippingTriangulator (ear-clipping-triangulator*) ~@options))
(defmacro ear-clipping-triangulator! (defmacro ear-clipping-triangulator!
"Calls a single method on a `ear-clipping-triangulator`"
[object k & options] [object k & options]
`(u/call! ^EarClippingTriangulator ~object ~k ~@options)) `(u/call! ^EarClippingTriangulator ~object ~k ~@options))
; ellipse ; ellipse
(defn ellipse* (defn ellipse*
"The function version of `ellipse`"
([] ([]
(Ellipse.)) (Ellipse.))
([x y width height] ([x y width height]
(Ellipse. x y width height))) (Ellipse. x y width height)))
(defmacro ellipse (defmacro ellipse
"Returns an [Ellipse](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Ellipse.html)"
[x y width height & options] [x y width height & options]
`(u/calls! ^Ellipse (ellipse* ~x ~y ~width ~height) ~@options)) `(u/calls! ^Ellipse (ellipse* ~x ~y ~width ~height) ~@options))
(defmacro ellipse! (defmacro ellipse!
"Calls a single method on an `ellipse`"
[object k & options] [object k & options]
`(u/call! ^Ellipse ~object ~k ~@options)) `(u/call! ^Ellipse ~object ~k ~@options))
; float-counter ; float-counter
(defn float-counter* (defn float-counter*
"The function version of `float-counter`"
[window-size] [window-size]
(FloatCounter. window-size)) (FloatCounter. window-size))
(defmacro float-counter (defmacro float-counter
"Returns a [FloatCounter](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/FloatCounter.html)"
[window-size & options] [window-size & options]
`(u/calls! ^FloatCounter (float-counter* ~window-size) ~@options)) `(u/calls! ^FloatCounter (float-counter* ~window-size) ~@options))
(defmacro float-counter! (defmacro float-counter!
"Calls a single method on a `float-counter`"
[object k & options] [object k & options]
`(u/call! ^FloatCounter ~object ~k ~@options)) `(u/call! ^FloatCounter ~object ~k ~@options))
; frustum ; frustum
(defn frustum* (defn frustum*
"The function version of `frustum`"
[] []
(Frustum.)) (Frustum.))
(defmacro frustum (defmacro frustum
"Returns a [Frustum](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Frustum.html)"
[& options] [& options]
`(u/calls! ^Frustum (frustum*) ~@options)) `(u/calls! ^Frustum (frustum*) ~@options))
(defmacro frustum! (defmacro frustum!
"Calls a single method on a `frustum`"
[object k & options] [object k & options]
`(u/call! ^Frustum ~object ~k ~@options)) `(u/call! ^Frustum ~object ~k ~@options))
; grid-point-2 ; grid-point-2
(defn grid-point-2* (defn grid-point-2*
"The function version of `grid-point-2`"
[x y] [x y]
(GridPoint2. x y)) (GridPoint2. x y))
(defmacro grid-point-2 (defmacro grid-point-2
"Returns a [GridPoint2](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/GridPoint2.html)"
[x y & options] [x y & options]
`(u/calls! ^GridPoint2 (grid-point-2* ~x ~y) ~@options)) `(u/calls! ^GridPoint2 (grid-point-2* ~x ~y) ~@options))
(defmacro grid-point-2! (defmacro grid-point-2!
"Calls a single method on a `grid-point-2`"
[object k & options] [object k & options]
`(u/call! ^GridPoint2 ~object ~k ~@options)) `(u/call! ^GridPoint2 ~object ~k ~@options))
; grid-point-3 ; grid-point-3
(defn grid-point-3* (defn grid-point-3*
"The function version of `grid-point-3`"
[x y z] [x y z]
(GridPoint3. x y z)) (GridPoint3. x y z))
(defmacro grid-point-3 (defmacro grid-point-3
"Returns a [GridPoint3](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/GridPoint3.html)"
[x y z & options] [x y z & options]
`(u/calls! ^GridPoint3 (grid-point-3* ~x ~y ~z) ~@options)) `(u/calls! ^GridPoint3 (grid-point-3* ~x ~y ~z) ~@options))
(defmacro grid-point-3! (defmacro grid-point-3!
"Calls a single method on a `grid-point-3`"
[object k & options] [object k & options]
`(u/call! ^GridPoint3 ~object ~k ~@options)) `(u/call! ^GridPoint3 ~object ~k ~@options))
; matrix-3 ; matrix-3
(defn matrix-3* (defn matrix-3*
"The function version of `matrix-3`"
([] ([]
(Matrix3.)) (Matrix3.))
([values] ([values]
(Matrix3. values))) (Matrix3. values)))
(defmacro matrix-3 (defmacro matrix-3
"Returns a [Matrix3](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Matrix3.html)"
[values & options] [values & options]
`(u/calls! ^Matrix3 (matrix-3* ~values) ~@options)) `(u/calls! ^Matrix3 (matrix-3* ~values) ~@options))
(defmacro matrix-3! (defmacro matrix-3!
"Calls a single method on a `matrix-3`"
[object k & options] [object k & options]
`(u/call! ^Matrix3 ~object ~k ~@options)) `(u/call! ^Matrix3 ~object ~k ~@options))
; matrix-4 ; matrix-4
(defn matrix-4* (defn matrix-4*
"The function version of `matrix-4`"
([] ([]
(Matrix4.)) (Matrix4.))
([^floats values] ([^floats values]
(Matrix4. values))) (Matrix4. values)))
(defmacro matrix-4 (defmacro matrix-4
"Returns a [Matrix4](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Matrix4.html)"
[values & options] [values & options]
`(u/calls! ^Matrix4 (matrix-4* ~values) ~@options)) `(u/calls! ^Matrix4 (matrix-4* ~values) ~@options))
(defmacro matrix-4! (defmacro matrix-4!
"Calls a single method on a `matrix-4`"
[object k & options] [object k & options]
`(u/call! ^Matrix4 ~object ~k ~@options)) `(u/call! ^Matrix4 ~object ~k ~@options))
; plane ; plane
(defn plane* (defn plane*
"The function version of `plane`"
[^Vector3 normal ^double d] [^Vector3 normal ^double d]
(Plane. normal d)) (Plane. normal d))
(defmacro plane (defmacro plane
"Returns a [Plane](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Plane.html)"
[normal d & options] [normal d & options]
`(u/calls! ^Plane (plane* ~normal ~d) ~@options)) `(u/calls! ^Plane (plane* ~normal ~d) ~@options))
(defmacro plane! (defmacro plane!
"Calls a single method on a `plane`"
[object k & options] [object k & options]
`(u/call! ^Plane ~object ~k ~@options)) `(u/call! ^Plane ~object ~k ~@options))
; polygon ; polygon
(defn polygon* (defn polygon*
"The function version of `polygon`"
([] ([]
(Polygon.)) (Polygon.))
([vertices] ([vertices]
(Polygon. vertices))) (Polygon. vertices)))
(defmacro polygon (defmacro polygon
"Returns a [Polygon](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Polygon.html)"
[vertices & options] [vertices & options]
`(u/calls! ^Polygon (polygon* ~vertices) ~@options)) `(u/calls! ^Polygon (polygon* ~vertices) ~@options))
(defmacro polygon! (defmacro polygon!
"Calls a single method on a `polygon`"
[object k & options] [object k & options]
`(u/call! ^Polygon ~object ~k ~@options)) `(u/call! ^Polygon ~object ~k ~@options))
; polyline ; polyline
(defn polyline* (defn polyline*
"The function version of `polyline`"
([] ([]
(Polyline.)) (Polyline.))
([vertices] ([vertices]
(Polyline. vertices))) (Polyline. vertices)))
(defmacro polyline (defmacro polyline
"Returns a [Polyline](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Polyline.html)"
[vertices & options] [vertices & options]
`(u/calls! ^Polyline (polyline* ~vertices) ~@options)) `(u/calls! ^Polyline (polyline* ~vertices) ~@options))
(defmacro polyline! (defmacro polyline!
"Calls a single method on a `polyline`"
[object k & options] [object k & options]
`(u/call! ^Polyline ~object ~k ~@options)) `(u/call! ^Polyline ~object ~k ~@options))
; quaternion ; quaternion
(defn quaternion* (defn quaternion*
"The function version of `quaternion`"
([] ([]
(Quaternion.)) (Quaternion.))
([w x y z] ([w x y z]
(Quaternion. w x y z))) (Quaternion. w x y z)))
(defmacro quaternion (defmacro quaternion
"Returns a [Quaternion](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Quaternion.html)"
[w x y z & options] [w x y z & options]
`(u/calls! ^Quaternion (quaternion* ~w ~x ~y ~z) ~@options)) `(u/calls! ^Quaternion (quaternion* ~w ~x ~y ~z) ~@options))
(defmacro quaternion! (defmacro quaternion!
"Calls a single method on a `quaternion`"
[object k & options] [object k & options]
`(u/call! ^Quaternion ~object ~k ~@options)) `(u/call! ^Quaternion ~object ~k ~@options))
; rectangle ; rectangle
(defn rectangle* (defn rectangle*
"The function version of `rectangle`"
([] ([]
(Rectangle.)) (Rectangle.))
([x y width height] ([x y width height]
(Rectangle. x y width height))) (Rectangle. x y width height)))
(defmacro rectangle (defmacro rectangle
"Returns a [Rectangle](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Rectangle.html)"
[x y width height & options] [x y width height & options]
`(u/calls! ^Rectangle (rectangle* ~x ~y ~width ~height) ~@options)) `(u/calls! ^Rectangle (rectangle* ~x ~y ~width ~height) ~@options))
(defmacro rectangle! (defmacro rectangle!
"Calls a single method on a `rectangle`"
[object k & options] [object k & options]
`(u/call! ^Rectangle ~object ~k ~@options)) `(u/call! ^Rectangle ~object ~k ~@options))
; vector-2 ; vector-2
(defn vector-2* (defn vector-2*
"The function version of `vector-2`"
([] ([]
(Vector2.)) (Vector2.))
([x y] ([x y]
(Vector2. x y))) (Vector2. x y)))
(defmacro vector-2 (defmacro vector-2
"Returns a [Vector2](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Vector2.html)"
[x y & options] [x y & options]
`(u/calls! ^Vector2 (vector-2* ~x ~y) ~@options)) `(u/calls! ^Vector2 (vector-2* ~x ~y) ~@options))
(defmacro vector-2! (defmacro vector-2!
"Calls a single method on a `vector-2`"
[object k & options] [object k & options]
`(u/call! ^Vector2 ~object ~k ~@options)) `(u/call! ^Vector2 ~object ~k ~@options))
; vector-3 ; vector-3
(defn vector-3* (defn vector-3*
"The function version of `vector-3`"
([] ([]
(Vector3.)) (Vector3.))
([x y z] ([x y z]
(Vector3. x y z))) (Vector3. x y z)))
(defmacro vector-3 (defmacro vector-3
"Returns a [Vector3](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Vector3.html)"
[x y z & options] [x y z & options]
`(u/calls! ^Vector3 (vector-3* ~x ~y ~z) ~@options)) `(u/calls! ^Vector3 (vector-3* ~x ~y ~z) ~@options))
(defmacro vector-3! (defmacro vector-3!
"Calls a single method on a `vector-3`"
[object k & options] [object k & options]
`(u/call! ^Vector3 ~object ~k ~@options)) `(u/call! ^Vector3 ~object ~k ~@options))
; windowed-mean ; windowed-mean
(defn windowed-mean* (defn windowed-mean*
"The function version of `windowed-mean`"
[window-size] [window-size]
(WindowedMean. window-size)) (WindowedMean. window-size))
(defmacro windowed-mean (defmacro windowed-mean
"Returns a [WindowedMean](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/WindowedMean.html)"
[window-size & options] [window-size & options]
`(u/calls! ^WindowedMean (windowed-mean* ~window-size) ~@options)) `(u/calls! ^WindowedMean (windowed-mean* ~window-size) ~@options))
(defmacro windowed-mean! (defmacro windowed-mean!
"Calls a single method on a `windowed-mean`"
[object k & options] [object k & options]
`(u/call! ^WindowedMean ~object ~k ~@options)) `(u/call! ^WindowedMean ~object ~k ~@options))