Higher-level mathematical plotting components built on the primitives provided
by Mathbox.cljs
.
Higher-level mathematical plotting components built on the primitives provided by `Mathbox.cljs`.
(AxisLabel {:keys [axis position size] :or {size 16 position 5} :as opts})
Component that renders an axis label above the referenced axis
.
Required arguments:
:axis
: one of :x
, :y
or :z
.Optional arguments:
:label
: the label to show. If label
is falsey or equal to ""
, this
component won't render.
:position
: the distance along the axis to place the label. Defaults to 5.
NOTE: Ideally we would figure out the parent Cartesian
and pick the top of
the range for the axis specified as the default.
:size
: size of the label. Defaults to 16.
Component that renders an axis label above the referenced `axis`. Required arguments: - `:axis`: one of `:x`, `:y` or `:z`. Optional arguments: - `:label`: the label to show. If `label` is falsey or equal to `""`, this component won't render. - `:position`: the distance along the axis to place the label. Defaults to 5. NOTE: Ideally we would figure out the parent `Cartesian` and pick the top of the range for the axis specified as the default. - `:size`: size of the label. Defaults to 16.
(Cartesian & children)
Component that renders a mathematical 3d plotting scene into MathBox. Takes any number of children and nests them into a configured [[mathbox.coordinates/Cartesian]] component.
Optional arguments:
:range
: triple of the form [<x-range> <y-range> <z-range>]
. Each range
entry is a pair of [<min-value> <max-value>]
.
Defaults to [-5 5]
in each dimension.
:scale
: [<x-scale> <y-scale> <z-scale>]
for tuning the relative space
given to each dimension in the rendering. Each entry defaults to 1.
:position
: [<x> <y> <z>]
world position of this cartesian. Defaults to
[0 0 0]
.
:camera
: Camera position in units I don't really understand yet! Defaults
to [0.5 -2 0.6]
.
:axes
: can be either
[:x :y]
{<axis-key> <boolean-or-[[LabeledAxis]]-arguments>}
Any axis entries missing from :axes
won't be rendered.
See LabeledAxis
for more detail on allowed configuration values.
:grids
: either
a vector like [:xy :yz]
a map of {<axis-key> <boolean-or-[[Grid]]-arguments>}
Any plane entries missing from :grids
won't be rendered.
See Grid
for more detail on allowed configuration values.
Component that renders a mathematical 3d plotting scene into MathBox. Takes any number of children and nests them into a configured [[mathbox.coordinates/Cartesian]] component. Optional arguments: - `:range`: triple of the form `[<x-range> <y-range> <z-range>]`. Each range entry is a pair of `[<min-value> <max-value>]`. Defaults to `[-5 5]` in each dimension. - `:scale`: `[<x-scale> <y-scale> <z-scale>]` for tuning the relative space given to each dimension in the rendering. Each entry defaults to 1. - `:position`: `[<x> <y> <z>]` world position of this cartesian. Defaults to `[0 0 0]`. - `:camera`: Camera position in units I don't really understand yet! Defaults to `[0.5 -2 0.6]`. - `:axes`: can be either - a vector like `[:x :y]` - a map of `{<axis-key> <boolean-or-[[LabeledAxis]]-arguments>}` Any axis entries missing from `:axes` won't be rendered. See [[LabeledAxis]] for more detail on allowed configuration values. - `:grids`: either - a vector like `[:xy :yz]` - a map of `{<axis-key> <boolean-or-[[Grid]]-arguments>}` Any plane entries missing from `:grids` won't be rendered. See [[Grid]] for more detail on allowed configuration values.
(DomLabel {:keys [tex? label size offset] :or {tex? true}})
Component that quite indulgently mounts a DOM element into the current MathBox scene.
NOTE that this is quite expensive and will slow down your updates! But when you need to show LaTeX this is where you should turn.
Required arguments:
:label
: string with the label you'd like to mount.Optional arguments:
:tex?
: when true
(default), mounts the label into the dom after
processing it with katex.
:size
: size of the label. Defaults to 12, or 18 if :tex?
is true.
:offset
: [<x-offset> <y-offset>]
for this label on the DOM. Defaults to
[0 20]
.
Component that _quite indulgently_ mounts a DOM element into the current MathBox scene. NOTE that this is quite expensive and will slow down your updates! But when you need to show LaTeX this is where you should turn. Required arguments: - `:label`: string with the label you'd like to mount. Optional arguments: - `:tex?`: when `true` (default), mounts the label into the dom after processing it with [katex](https://katex.org/). - `:size`: size of the label. Defaults to 12, or 18 if `:tex?` is true. - `:offset`: `[<x-offset> <y-offset>]` for this label on the DOM. Defaults to `[0 20]`.
(Grid {:keys [axes width opacity color z-order z-index z-bias snap divisions]
:or {z-bias 0 z-index 0 width 0.5 opacity 1 color "#808080"}})
Component that takes an :axes
option equal to :xy
, :yz
or :xz
and
renders a grid in the specified plane into the MathBox scene.
Required arguments:
:axes
: one of :xy
, :yz
or :xz
.Optional arguments:
:snap
: either true
, false
, a single number or a 2-vector of numbers of
the form [<snap-x?> <snap-y?>]
. A non-vector value becomes a pair with the
same value in both slots.
"snapping" the grid means that gridlines will snap to nice numbers.
false
by default.
:divisions
: either a single number or a 2-vector of numbers of the form
[<first-axis-divisions> <second-axis-divisions>]
. A non-vector value becomes
a pair with the same value in both slots.
divisions set the number of gridlines that appear in each dimension.
:width
: width of the lines on the rendered grid.
:opacity
: opacity of the grid. Defaults to 1.0.
:color
: color of the grid. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the grid.
:z-index
: zIndex of the grid. Defaults to 0.
:z-bias
: zBias of the grid. Defaults to 0.
Component that takes an `:axes` option equal to `:xy`, `:yz` or `:xz` and renders a grid in the specified plane into the MathBox scene. Required arguments: - `:axes`: one of `:xy`, `:yz` or `:xz`. Optional arguments: - `:snap`: either `true`, `false`, a single number or a 2-vector of numbers of the form `[<snap-x?> <snap-y?>]`. A non-vector value becomes a pair with the same value in both slots. "snapping" the grid means that gridlines will snap to nice numbers. `false` by default. - `:divisions`: either a single number or a 2-vector of numbers of the form `[<first-axis-divisions> <second-axis-divisions>]`. A non-vector value becomes a pair with the same value in both slots. divisions set the number of gridlines that appear in each dimension. - `:width`: width of the lines on the rendered grid. - `:opacity`: opacity of the grid. Defaults to 1.0. - `:color`: color of the grid. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the grid. - `:z-index`: zIndex of the grid. Defaults to 0. - `:z-bias`: zBias of the grid. Defaults to 0.
(LabeledAxis {:keys [axis width opacity color z-order z-index z-bias max start?
end?]
:or {z-bias 0
z-index 0
opacity 1
width 1
start? false
end? false
color "#808080"}
:as opts})
Component that takes an :axis
option equal to :x
, :y
or :z
and renders
the equivalent axis into the MathBox scene.
Required arguments:
:axis
: one of :x
, :y
or :z
.Optional arguments:
:ticks
: either true
(default), falsey or a map of Ticks
options.
See Ticks
for details on what's allowed.
true
will include default ticks, while false
or nil
will remove ticks.
:label
: either true
(default) or a map of AxisLabel
options.
See AxisLabel
for details on what's allowed.
true
will include the default label and ticks, while false
or nil
will
remove the label.
:width
: width of the rendered axis line.
:start?
: if true
, renders an arrow at the start of the axis. Defaults
to false
.
:end?
: if true
, renders an arrow at the end of the segment. Defaults to
false
.
:end?
if true
(default), renders the ending tick.
:opacity
: opacity of the axis (not currently passed on to ticks or
labels). Defaults to 1.0.
:color
: color of the axis. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the full labeled axis.
:z-index
: zIndex of the full labeled axis. Defaults to 0.
:z-bias
: zBias of the full labeled axis. Defaults to 0.
:label
: either true
(default), false
, or a map of options.
:max
: the maximum value reached along this axis. This is used to pass a
default :position
argument to the AxisLabel
component if one isn't set.
NOTE this is a hack, see the comment above the component for an alternate approach.
Component that takes an `:axis` option equal to `:x`, `:y` or `:z` and renders the equivalent axis into the MathBox scene. Required arguments: - `:axis`: one of `:x`, `:y` or `:z`. Optional arguments: - `:ticks`: either `true` (default), falsey or a map of [[Ticks]] options. See [[Ticks]] for details on what's allowed. `true` will include default ticks, while `false` or `nil` will remove ticks. - `:label`: either `true` (default) or a map of [[AxisLabel]] options. See [[AxisLabel]] for details on what's allowed. `true` will include the default label and ticks, while `false` or `nil` will remove the label. - `:width`: width of the rendered axis line. - `:start?`: if `true`, renders an arrow at the start of the axis. Defaults to `false`. - `:end?`: if `true`, renders an arrow at the end of the segment. Defaults to `false`. - `:end?` if `true` (default), renders the ending tick. - `:opacity`: opacity of the axis (not currently passed on to ticks or labels). Defaults to 1.0. - `:color`: color of the axis. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the full labeled axis. - `:z-index`: zIndex of the full labeled axis. Defaults to 0. - `:z-bias`: zBias of the full labeled axis. Defaults to 0. - `:label`: either `true` (default), `false`, or a map of options. - `:max`: the maximum value reached along this axis. This is used to pass a default `:position` argument to the [[AxisLabel]] component if one isn't set. NOTE this is a hack, see the comment above the component for an alternate approach.
(Line {:keys [coords arrow-size width start? end? label opacity color z-order
z-index z-bias]
:or {z-index 0 z-bias 0 opacity 1 arrow-size 6 width 4 color "#3498db"}})
Component that renders a line segment into the scene as specified by coords
.
Required arguments:
:coords
: a pair of 3-vectors of the form [<x> <y> <z>]
specifying the
line segment's starting and ending coordinates.Optional arguments:
:label
: either:
:start
and :end
[<start> <end>]
specifying the labels to hover over the start and end of the rendered line segment.
:width
: width of the line. Defaults to 4.
:start?
: if true
, renders an arrow at the start of the segment. Defaults
to false
.
:end?
: if true
, renders an arrow at the end of the segment. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:opacity
: opacity of the point. Defaults to 1.0.
:color
: color of the point. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the point.
:z-index
: zIndex of the point. Defaults to 0.
:z-bias
: zBias of the point. Defaults to 0.
Component that renders a line segment into the scene as specified by `coords`. Required arguments: - `:coords`: a pair of 3-vectors of the form `[<x> <y> <z>]` specifying the line segment's starting and ending coordinates. Optional arguments: - `:label`: either: - a string label, - a map with optional keys `:start` and `:end` - a vector of the form `[<start> <end>]` specifying the labels to hover over the start and end of the rendered line segment. - `:width`: width of the line. Defaults to 4. - `:start?`: if `true`, renders an arrow at the start of the segment. Defaults to `false`. - `:end?`: if `true`, renders an arrow at the end of the segment. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:opacity`: opacity of the point. Defaults to 1.0. - `:color`: color of the point. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the point. - `:z-index`: zIndex of the point. Defaults to 0. - `:z-bias`: zBias of the point. Defaults to 0.
(OfX {:keys [y z] :as opts})
Component that plots a function in either the y
or z
directions as a
function of x
values.
Required arguments:
:y
or :z
: function of the form (fn [x] <y-or-z>)
, valid within the
scene's x-axis range or the range specified by :range
.
NOTE that you may only supply ONE of these two! Supplying both will trigger an error.
Optional arguments:
:samples
: the number of points to use to generate the curve. Defaults to
256.
:range
: 2-vector of the form [<min-x> <max-x>]
specifying the range to
feed into :y
or :z
.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of the curve. Defaults to 4.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a function in either the `y` or `z` directions as a function of `x` values. Required arguments: - `:y` or `:z`: function of the form `(fn [x] <y-or-z>)`, valid within the scene's x-axis range or the range specified by `:range`. NOTE that you may only supply ONE of these two! Supplying both will trigger an error. Optional arguments: - `:samples`: the number of points to use to generate the curve. Defaults to 256. - `:range`: 2-vector of the form `[<min-x> <max-x>]` specifying the range to feed into `:y` or `:z`. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of the curve. Defaults to 4. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(OfXY _)
Component that plots an explicit surface defined by :z
into the scene along the
area specified by :x-range
and :y-range
.
Required arguments:
:z
: function of the form (fn [[x y]] [<z>])
, valid within the
area specified by :x-range
and :y-range
.Optional arguments:
:x-range
: 2-vector of the form [<min-x> <max-x>]
specifying the interval
of the first input to f
. Defaults to the scene's range.
:y-range
: 2-vector of the form [<min-y> <max-y>]
specifying the interval
of the second input to f
. Defaults to the scene's range.
:x-samples
: the number of x samples to use to generate the surface.
Defaults to 64.
:y-samples
: the number of y samples to use to generate the surface.
Defaults to 64.
:shaded?
if true
(default), MathBox will shade the surface.
:opacity
: opacity of the surface. Defaults to 0.75.
:color
: color of the surface. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the surface. Defaults to 25.
:z-index
: zIndex of the surface. Defaults to 0.
:z-bias
: zBias of the surface. Defaults to 0.
Optional arguments for configuring grid lines:
:grid-x
: the number of lines of constant x
to plot along the surface.
:grid-y
: the number of lines of constant y
to plot along the surface.
:grid-opacity
: opacity of the grid lines. Defaults to 0.5.
:grid-width
: width of the grid lines.
:grid-color
: color of the grid lines. Defaults to a darkened version of
:color
.
Component that plots an explicit surface defined by `:z` into the scene along the area specified by `:x-range` and `:y-range`. Required arguments: - `:z`: function of the form `(fn [[x y]] [<z>])`, valid within the area specified by `:x-range` and `:y-range`. Optional arguments: - `:x-range`: 2-vector of the form `[<min-x> <max-x>]` specifying the interval of the first input to `f`. Defaults to the scene's range. - `:y-range`: 2-vector of the form `[<min-y> <max-y>]` specifying the interval of the second input to `f`. Defaults to the scene's range. - `:x-samples`: the number of x samples to use to generate the surface. Defaults to 64. - `:y-samples`: the number of y samples to use to generate the surface. Defaults to 64. - `:shaded?` if `true` (default), MathBox will shade the surface. - `:opacity`: opacity of the surface. Defaults to 0.75. - `:color`: color of the surface. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the surface. Defaults to 25. - `:z-index`: zIndex of the surface. Defaults to 0. - `:z-bias`: zBias of the surface. Defaults to 0. Optional arguments for configuring grid lines: - `:grid-x`: the number of lines of constant `x` to plot along the surface. - `:grid-y`: the number of lines of constant `y` to plot along the surface. - `:grid-opacity`: opacity of the grid lines. Defaults to 0.5. - `:grid-width`: width of the grid lines. - `:grid-color`: color of the grid lines. Defaults to a darkened version of `:color`.
(OfXZ _)
Component that plots an explicit surface defined by :z
into the scene along the
area specified by :x-range
and :z-range
.
Required arguments:
:y
: function of the form (fn [[x z]] [<y>])
, valid within the
area specified by :x-range
and :z-range
.Optional arguments:
:x-range
: 2-vector of the form [<min-x> <max-x>]
specifying the interval
of the first input to f
. Defaults to the scene's range.
:z-range
: 2-vector of the form [<min-z> <max-z>]
specifying the interval
of the second input to f
. Defaults to the scene's range.
:x-samples
: the number of x samples to use to generate the surface.
Defaults to 64.
:z-samples
: the number of z samples to use to generate the surface.
Defaults to 64.
:shaded?
if true
(default), MathBox will shade the surface.
:opacity
: opacity of the surface. Defaults to 0.75.
:color
: color of the surface. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the surface. Defaults to 25.
:z-index
: zIndex of the surface. Defaults to 0.
:z-bias
: zBias of the surface. Defaults to 0.
Optional arguments for configuring grid lines:
:grid-x
: the number of lines of constant x
to plot along the surface.
:grid-z
: the number of lines of constant z
to plot along the surface.
:grid-opacity
: opacity of the grid lines. Defaults to 0.5.
:grid-width
: width of the grid lines.
:grid-color
: color of the grid lines. Defaults to a darkened version of
:color
.
Component that plots an explicit surface defined by `:z` into the scene along the area specified by `:x-range` and `:z-range`. Required arguments: - `:y`: function of the form `(fn [[x z]] [<y>])`, valid within the area specified by `:x-range` and `:z-range`. Optional arguments: - `:x-range`: 2-vector of the form `[<min-x> <max-x>]` specifying the interval of the first input to `f`. Defaults to the scene's range. - `:z-range`: 2-vector of the form `[<min-z> <max-z>]` specifying the interval of the second input to `f`. Defaults to the scene's range. - `:x-samples`: the number of x samples to use to generate the surface. Defaults to 64. - `:z-samples`: the number of z samples to use to generate the surface. Defaults to 64. - `:shaded?` if `true` (default), MathBox will shade the surface. - `:opacity`: opacity of the surface. Defaults to 0.75. - `:color`: color of the surface. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the surface. Defaults to 25. - `:z-index`: zIndex of the surface. Defaults to 0. - `:z-bias`: zBias of the surface. Defaults to 0. Optional arguments for configuring grid lines: - `:grid-x`: the number of lines of constant `x` to plot along the surface. - `:grid-z`: the number of lines of constant `z` to plot along the surface. - `:grid-opacity`: opacity of the grid lines. Defaults to 0.5. - `:grid-width`: width of the grid lines. - `:grid-color`: color of the grid lines. Defaults to a darkened version of `:color`.
(OfY {:keys [x z] :as opts})
Component that plots a function in either the x
or z
directions as a
function of y
values.
Required arguments:
:x
or :z
: function of the form (fn [y] <x-or-z>)
, valid within the
scene's y-axis range or the range specified by :range
.
NOTE that you may only supply ONE of these two! Supplying both will trigger an error.
Optional arguments:
:samples
: the number of points to use to generate the curve. Defaults to
256.
:range
: 2-vector of the form [<min-y> <max-y>]
specifying the range to
feed into :x
or :z
.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of the curve. Defaults to 4.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a function in either the `x` or `z` directions as a function of `y` values. Required arguments: - `:x` or `:z`: function of the form `(fn [y] <x-or-z>)`, valid within the scene's y-axis range or the range specified by `:range`. NOTE that you may only supply ONE of these two! Supplying both will trigger an error. Optional arguments: - `:samples`: the number of points to use to generate the curve. Defaults to 256. - `:range`: 2-vector of the form `[<min-y> <max-y>]` specifying the range to feed into `:x` or `:z`. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of the curve. Defaults to 4. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(OfYZ _)
Component that plots an explicit surface defined by :x
into the scene along the
area specified by :y-range
and :z-range
.
Required arguments:
:x
: function of the form (fn [[y z]] [<x>])
, valid within the
area specified by :y-range
and :z-range
.Optional arguments:
:y-range
: 2-vector of the form [<min-y> <max-y>]
specifying the interval
of the first input to f
. Defaults to the scene's range.
:z-range
: 2-vector of the form [<min-z> <max-z>]
specifying the interval
of the second input to f
. Defaults to the scene's range.
:y-samples
: the number of y samples to use to generate the surface.
Defaults to 64.
:z-samples
: the number of z samples to use to generate the surface.
Defaults to 64.
:shaded?
if true
(default), MathBox will shade the surface.
:opacity
: opacity of the surface. Defaults to 0.75.
:color
: color of the surface. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the surface. Defaults to 25.
:z-index
: zIndex of the surface. Defaults to 0.
:z-bias
: zBias of the surface. Defaults to 0.
Optional arguments for configuring grid lines:
:grid-y
: the number of lines of constant y
to plot along the surface.
:grid-z
: the number of lines of constant z
to plot along the surface.
:grid-opacity
: opacity of the grid lines. Defaults to 0.5.
:grid-width
: width of the grid lines.
:grid-color
: color of the grid lines. Defaults to a darkened version of
:color
.
Component that plots an explicit surface defined by `:x` into the scene along the area specified by `:y-range` and `:z-range`. Required arguments: - `:x`: function of the form `(fn [[y z]] [<x>])`, valid within the area specified by `:y-range` and `:z-range`. Optional arguments: - `:y-range`: 2-vector of the form `[<min-y> <max-y>]` specifying the interval of the first input to `f`. Defaults to the scene's range. - `:z-range`: 2-vector of the form `[<min-z> <max-z>]` specifying the interval of the second input to `f`. Defaults to the scene's range. - `:y-samples`: the number of y samples to use to generate the surface. Defaults to 64. - `:z-samples`: the number of z samples to use to generate the surface. Defaults to 64. - `:shaded?` if `true` (default), MathBox will shade the surface. - `:opacity`: opacity of the surface. Defaults to 0.75. - `:color`: color of the surface. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the surface. Defaults to 25. - `:z-index`: zIndex of the surface. Defaults to 0. - `:z-bias`: zBias of the surface. Defaults to 0. Optional arguments for configuring grid lines: - `:grid-y`: the number of lines of constant `y` to plot along the surface. - `:grid-z`: the number of lines of constant `z` to plot along the surface. - `:grid-opacity`: opacity of the grid lines. Defaults to 0.5. - `:grid-width`: width of the grid lines. - `:grid-color`: color of the grid lines. Defaults to a darkened version of `:color`.
(OfZ {:keys [x y] :as opts})
Component that plots a function in either the x
or y
directions as a
function of z
values.
Required arguments:
:x
or :y
: function of the form (fn [z] <x-or-y>)
, valid within the
scene's z-axis range or the range specified by :range
.
NOTE that you may only supply ONE of these two! Supplying both will trigger an error.
Optional arguments:
:samples
: the number of points to use to generate the curve. Defaults to
256.
:range
: 2-vector of the form [<min-z> <max-z>]
specifying the range to
feed into :x
or :y
.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of the curve. Defaults to 4.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a function in either the `x` or `y` directions as a function of `z` values. Required arguments: - `:x` or `:y`: function of the form `(fn [z] <x-or-y>)`, valid within the scene's z-axis range or the range specified by `:range`. NOTE that you may only supply ONE of these two! Supplying both will trigger an error. Optional arguments: - `:samples`: the number of points to use to generate the curve. Defaults to 256. - `:range`: 2-vector of the form `[<min-z> <max-z>]` specifying the range to feed into `:x` or `:y`. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of the curve. Defaults to 4. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(ParametricCurve opts)
Component that plots a parametric curve f
into the scene along the range
specified by t
.
Required arguments:
:f
: function of the form (fn [t] [<x> <y> <z>])
, valid within the range
specified by :t
.
:t
2-vector of the form [<min-t> <max-t>]
specifying the domain of the
parametric function f
.
Optional arguments:
:samples
: the number of points to use to generate the curve. Defaults to
256.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of the curve. Defaults to 4.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a parametric curve `f` into the scene along the range specified by `t`. Required arguments: - `:f`: function of the form `(fn [t] [<x> <y> <z>])`, valid within the range specified by `:t`. - `:t` 2-vector of the form `[<min-t> <max-t>]` specifying the domain of the parametric function `f`. Optional arguments: - `:samples`: the number of points to use to generate the curve. Defaults to 256. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of the curve. Defaults to 4. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(ParametricSurface opts)
Component that plots a parametric surface defined by f
into the scene along
the area specified by u
and v
.
Required arguments:
:f
: function of the form (fn [[u v]] [<x> <y> <z>])
, valid within the
area specified by :u
and :v
.
:u
2-vector of the form [<min-u> <max-u>]
specifying the interval of the
first input to f
.
:v
: 2-vector of the form [<min-v> <max-v>]
specifying the interval of the
second input to f
.
Optional arguments:
:u-samples
: the number of u samples to use to generate the surface.
Defaults to 64.
:v-samples
: the number of v samples to use to generate the surface.
Defaults to 64.
:shaded?
if true
(default), MathBox will shade the surface.
:opacity
: opacity of the surface. Defaults to 0.75.
:color
: color of the surface. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the surface. Defaults to 25.
:z-index
: zIndex of the surface. Defaults to 0.
:z-bias
: zBias of the surface. Defaults to 0.
Optional arguments for configuring grid lines:
:grid-u
: the number of lines of constant u
to plot along the surface.
:grid-v
: the number of lines of constant v
to plot along the surface.
:grid-opacity
: opacity of the grid lines. Defaults to 0.5.
:grid-width
: width of the grid lines.
:grid-color
: color of the grid lines. Defaults to a darkened version of
:color
.
Component that plots a parametric surface defined by `f` into the scene along the area specified by `u` and `v`. Required arguments: - `:f`: function of the form `(fn [[u v]] [<x> <y> <z>])`, valid within the area specified by `:u` and `:v`. - `:u` 2-vector of the form `[<min-u> <max-u>]` specifying the interval of the first input to `f`. - `:v`: 2-vector of the form `[<min-v> <max-v>]` specifying the interval of the second input to `f`. Optional arguments: - `:u-samples`: the number of u samples to use to generate the surface. Defaults to 64. - `:v-samples`: the number of v samples to use to generate the surface. Defaults to 64. - `:shaded?` if `true` (default), MathBox will shade the surface. - `:opacity`: opacity of the surface. Defaults to 0.75. - `:color`: color of the surface. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the surface. Defaults to 25. - `:z-index`: zIndex of the surface. Defaults to 0. - `:z-bias`: zBias of the surface. Defaults to 0. Optional arguments for configuring grid lines: - `:grid-u`: the number of lines of constant `u` to plot along the surface. - `:grid-v`: the number of lines of constant `v` to plot along the surface. - `:grid-opacity`: opacity of the grid lines. Defaults to 0.5. - `:grid-width`: width of the grid lines. - `:grid-color`: color of the grid lines. Defaults to a darkened version of `:color`.
(Point {:keys [label size coords opacity color z-order z-index z-bias]
:or {size 16 z-index 0 z-bias 0 opacity 1 color color/default}})
Component that renders a point into the scene at coords
.
Required arguments:
:coords
: 3-vector of the form [<x> <y> <z>]
specifying the point's
coordinates.Optional arguments:
:label
: either a string label or an options map input to DomLabel
. If
:tex?
is true in this map, the component will use katex to render the label.
NOTE that this is computationally expensive for reasons I don't understand!
:size
: size of the point. Defaults to 16.
:opacity
: opacity of the point. Defaults to 1.0.
:color
: color of the point. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the point.
:z-index
: zIndex of the point. Defaults to 0.
:z-bias
: zBias of the point. Defaults to 0.
Component that renders a point into the scene at `coords`. Required arguments: - `:coords`: 3-vector of the form `[<x> <y> <z>]` specifying the point's coordinates. Optional arguments: - `:label`: either a string label or an options map input to [[DomLabel]]. If `:tex?` is true in this map, the component will use katex to render the label. NOTE that this is computationally expensive for reasons I don't understand! - `:size`: size of the point. Defaults to 16. - `:opacity`: opacity of the point. Defaults to 1.0. - `:color`: color of the point. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the point. - `:z-index`: zIndex of the point. Defaults to 0. - `:z-bias`: zBias of the point. Defaults to 0.
(PolarCurve {:keys [r range] :or {range [0 (* 2 Math/PI)]} :as opts})
Component that plots a polar curve, ie, radius as a function of theta.
Required arguments:
:r
: function of the form (fn [theta] <r>)
, valid within the range of
theta values specified by :range
.
NOTE that you may only supply ONE of these two! Supplying both will trigger an error.
Optional arguments:
:samples
: the number of points to use to generate the curve. Defaults to
256.
:range
: 2-vector of the form [<min-theta> <max-theta>]
specifying the
range to feed into :r
. Defaults to [0 (* 2 Math/PI)]
.
:start?
if true
, renders an arrow at the start of the curve. Defaults to
false
.
:end?
if true
, renders an arrow at the end of the curve. Defaults to
false
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of the curve. Defaults to 4.
:opacity
: opacity of the curve. Defaults to 1.0.
:color
: color of the curve. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the curve.
:z-index
: zIndex of the curve. Defaults to 0.
:z-bias
: zBias of the curve. Defaults to 0.
Component that plots a polar curve, ie, radius as a function of theta. Required arguments: - `:r`: function of the form `(fn [theta] <r>)`, valid within the range of theta values specified by `:range`. NOTE that you may only supply ONE of these two! Supplying both will trigger an error. Optional arguments: - `:samples`: the number of points to use to generate the curve. Defaults to 256. - `:range`: 2-vector of the form `[<min-theta> <max-theta>]` specifying the range to feed into `:r`. Defaults to `[0 (* 2 Math/PI)]`. - `:start?` if `true`, renders an arrow at the start of the curve. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of the curve. Defaults to `false`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of the curve. Defaults to 4. - `:opacity`: opacity of the curve. Defaults to 1.0. - `:color`: color of the curve. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the curve. - `:z-index`: zIndex of the curve. Defaults to 0. - `:z-bias`: zBias of the curve. Defaults to 0.
(PolarSurface _)
Component that plots a polar surface defined by :f
into the scene along the
area specified by :r-range
and :theta-range
.
Required arguments:
:f
: function of the form (fn [[r theta]] [<z>])
, valid within the
area specified by :r-range
and :theta-range
.Optional arguments:
:r-range
: 2-vector of the form [<min-r> <max-r>]
specifying the interval
of the first input to f
. Defaults to [0 3]
.
:theta-range
: 2-vector of the form [<min-theta> <max-theta>]
specifying
the interval of the second input to f
. Defaults to [0 (* 2 Math/PI)]
.
:r-samples
: the number of r samples to use to generate the surface.
Defaults to 64.
:theta-samples
: the number of theta samples to use to generate the
surface. Defaults to 64.
:shaded?
if true
(default), MathBox will shade the surface.
:opacity
: opacity of the surface. Defaults to 0.75.
:color
: color of the surface. This can be a three.js
Color
object or any
valid input to its constructor.
:z-order
: z-order of the surface. Defaults to 25.
:z-index
: zIndex of the surface. Defaults to 0.
:z-bias
: zBias of the surface. Defaults to 0.
Optional arguments for configuring grid lines:
:grid-r
: the number of lines of constant r
to plot along the surface.
:grid-theta
: the number of lines of constant theta
to plot along the surface.
:grid-opacity
: opacity of the grid lines. Defaults to 0.5.
:grid-width
: width of the grid lines.
:grid-color
: color of the grid lines. Defaults to a darkened version of
:color
.
Component that plots a polar surface defined by `:f` into the scene along the area specified by `:r-range` and `:theta-range`. Required arguments: - `:f`: function of the form `(fn [[r theta]] [<z>])`, valid within the area specified by `:r-range` and `:theta-range`. Optional arguments: - `:r-range`: 2-vector of the form `[<min-r> <max-r>]` specifying the interval of the first input to `f`. Defaults to `[0 3]`. - `:theta-range`: 2-vector of the form `[<min-theta> <max-theta>]` specifying the interval of the second input to `f`. Defaults to `[0 (* 2 Math/PI)]`. - `:r-samples`: the number of r samples to use to generate the surface. Defaults to 64. - `:theta-samples`: the number of theta samples to use to generate the surface. Defaults to 64. - `:shaded?` if `true` (default), MathBox will shade the surface. - `:opacity`: opacity of the surface. Defaults to 0.75. - `:color`: color of the surface. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the surface. Defaults to 25. - `:z-index`: zIndex of the surface. Defaults to 0. - `:z-bias`: zBias of the surface. Defaults to 0. Optional arguments for configuring grid lines: - `:grid-r`: the number of lines of constant `r` to plot along the surface. - `:grid-theta`: the number of lines of constant `theta` to plot along the surface. - `:grid-opacity`: opacity of the grid lines. Defaults to 0.5. - `:grid-width`: width of the grid lines. - `:grid-color`: color of the grid lines. Defaults to a darkened version of `:color`.
(Scene & children)
Takes an optional options map and any number of children and nests them into a configured [[mathbox.coordinates/Cartesian]] component that renders a mathematical 3d plotting scene into MathBox.
Any option supported by [[mathbox.core/MathBox]] is removed and passed along
to that component, after merging with box-defaults
.
See Cartesian
for all other supported options.
Takes an optional options map and any number of children and nests them into a configured [[mathbox.coordinates/Cartesian]] component that renders a mathematical 3d plotting scene into MathBox. Any option supported by [[mathbox.core/MathBox]] is removed and passed along to that component, after merging with [[box-defaults]]. See [[Cartesian]] for all other supported options.
(SceneAxes axes)
(SceneAxes axes range)
Component that renders multiple LabeledAxis
components into a scene.
axes
can be either
[:x :y]
{<axis-key> <boolean-or-[[LabeledAxis]]-arguments>}
range
(optional) is a 3-vector with the rendered ranges in the x
, y
and
z
directions.
Any axis entries missing from axes
won't be rendered.
NOTE: This argument is only used to fill in the :max
argument
to LabeledAxis
for default label positioning. It should go away once we
get a better strategy!
Component that renders multiple [[LabeledAxis]] components into a scene. `axes` can be either - a vector like `[:x :y]` - a map of `{<axis-key> <boolean-or-[[LabeledAxis]]-arguments>}` `range` (optional) is a 3-vector with the rendered ranges in the `x`, `y` and `z` directions. Any axis entries missing from `axes` won't be rendered. NOTE: This argument is only used to fill in the `:max` argument to [[LabeledAxis]] for default label positioning. It should go away once we get a better strategy!
(SceneGrids grids)
Component that renders multiple Grid
objects into a scene.
grids
can be either
[:xy :yz]
{<axis-key> <boolean-or-[[Grid]]-arguments>}
Any plane entries missing from grids
won't be rendered.
Component that renders multiple [[Grid]] objects into a scene. `grids` can be either - a vector like `[:xy :yz]` - a map of `{<axis-key> <boolean-or-[[Grid]]-arguments>}` Any plane entries missing from `grids` won't be rendered.
(Ticks {:keys [axis divisions width snap? zero? start? end? labels? label-fn
color background text-size offset z-order z-index z-bias]
:or {text-size 16
start? true
snap? false
label-fn p/format-number
end? true
z-bias 0
divisions 10
zero? false
width 2
z-index 0
labels? true}})
Component that renders tick marks onto a scene, lined up with an axis.
Required arguments:
:axis
: one of :x
, :y
or :z
.Optional arguments:
:divisions
: the number of divisions (ticks) to generate. Defaults to 10.
:width
: width of each tick. Defaults to 2.
:snap?
if true
, the ticks will snap to "nice" values. false
by default.
:start?
if true
(default), renders the starting tick.
:end?
if true
(default), renders the ending tick.
:zero?
if true
, renders the tick at 0. false
by default.
:size
: size of the label. Defaults to 12.
:offset
: [<x-offset> <y-offset>]
for the label on each tick. Defaults to
[20 0]
if :axis
equals :z
, else [0 -20]
.
:labels?
: if true
(default), renders a printed label underneath each
tick for the :x
and :y
axes, or alongside the axis for :z
.
:label-fn
: (fn [x] <string>)
for generating the printed representation
of each tick mark's value. Defaults to emmy.viewer.plot/format-number
. You
might also enjoy emmy.viewer.plot/label-pi
.
:z-order
: z-order of the labeled axis.
:z-index
: zIndex of the labeled axis. Defaults to 0.
:z-bias
: zBias of the labeled axis. Defaults to 0.
Component that renders tick marks onto a scene, lined up with an axis. Required arguments: - `:axis`: one of `:x`, `:y` or `:z`. Optional arguments: - `:divisions`: the number of divisions (ticks) to generate. Defaults to 10. - `:width`: width of each tick. Defaults to 2. - `:snap?` if `true`, the ticks will snap to "nice" values. `false` by default. - `:start?` if `true` (default), renders the starting tick. - `:end?` if `true` (default), renders the ending tick. - `:zero?` if `true`, renders the tick at 0. `false` by default. - `:size`: size of the label. Defaults to 12. - `:offset`: `[<x-offset> <y-offset>]` for the label on each tick. Defaults to `[20 0]` if `:axis` equals `:z`, else `[0 -20]`. - `:labels?`: if `true` (default), renders a printed label underneath each tick for the `:x` and `:y` axes, or alongside the axis for `:z`. - `:label-fn`: `(fn [x] <string>)` for generating the printed representation of each tick mark's value. Defaults to [[emmy.viewer.plot/format-number]]. You might also enjoy [[emmy.viewer.plot/label-pi]]. - `:z-order`: z-order of the labeled axis. - `:z-index`: zIndex of the labeled axis. Defaults to 0. - `:z-bias`: zBias of the labeled axis. Defaults to 0.
(Vector {:keys [tip tail] :or {tail [0 0 0]} :as opts})
Component that renders a vector into the scene with the specified tip
and
tail
.
Required arguments:
:tip
: 3-vector of the form [<x> <y> <z>]
specifying the tip of the
vector.Optional arguments:
:tail
: 3-vector of the form [<x> <y> <z>]
specifying the tail of the
vector. Defaults to [0 0 0]
.See Line
for all other supported options. All defaults are identical,
except :end?
defaults to true
.
Component that renders a vector into the scene with the specified `tip` and `tail`. Required arguments: - `:tip`: 3-vector of the form `[<x> <y> <z>]` specifying the tip of the vector. Optional arguments: - `:tail`: 3-vector of the form `[<x> <y> <z>]` specifying the tail of the vector. Defaults to `[0 0 0]`. See [[Line]] for all other supported options. All defaults are identical, except `:end?` defaults to `true`.
(VectorField {:keys [f scale x-samples y-samples z-samples x-range y-range
z-range arrow-size width start? end? opacity color z-order
z-index z-bias]
:or {start? false
y-samples 10
color "#3090ff"
x-samples 10
end? true
scale 1
z-bias 0
width 2
z-index 0
z-samples 10
opacity 1
arrow-size 6}})
Component that plots a vector field defined by :f
into the scene along the
volume specified by :x-range
, :y-range
and :z-range
.
Required arguments:
:f
: function of the form (fn [[x y z]] [<x> <y> <z>])
, valid within the
area specified by :x-range
, :y-range
and :z-range
.
The function should return the coordinates of the tip of a vector with
origin at [0 0 0]
; VectorField
will translate each vector to start at
[x y z]
.
Optional arguments:
:scale
: Optional scale factor to apply to each vector's magnitude.
Defaults to 1.0.
:x-range
: 2-vector of the form [<min-x> <max-x>]
specifying the interval
of the first input to f
. Defaults to the scene's range.
:y-range
: 2-vector of the form [<min-y> <max-y>]
specifying the interval
of the first input to f
. Defaults to the scene's range.
:z-range
: 2-vector of the form [<min-z> <max-z>]
specifying the interval
of the second input to f
. Defaults to the scene's range.
:x-samples
: the number of vectors to plot in the x
direction. Defaults
to 10.
:y-samples
: the number of vectors to plot in the y
direction. Defaults
to 10.
:z-samples
: the number of vectors to plot in the z
direction. Defaults
to 10.
:start?
if true
, renders an arrow at the start of each vector. Defaults
to false
.
:end?
if true
, renders an arrow at the end of each vector. Defaults to
true
.
:arrow-size
: size of the arrows toggled by :start?
and :end?
. Defaults
to 6.
:width
: width of each vector. Defaults to 2.
:opacity
: opacity of each vector. Defaults to 1.0.
:color
: color of each vector. This can be a three.js
Color
object
or any valid input to its
constructor.
:z-order
: z-order of the vector field.
:z-index
: zIndex of the vector field. Defaults to 0.
:z-bias
: zBias of the vector field. Defaults to 0.
Component that plots a vector field defined by `:f` into the scene along the volume specified by `:x-range`, `:y-range` and `:z-range`. Required arguments: - `:f`: function of the form `(fn [[x y z]] [<x> <y> <z>])`, valid within the area specified by `:x-range`, `:y-range` and `:z-range`. The function should return the coordinates of the tip of a vector with origin at `[0 0 0]`; [[VectorField]] will translate each vector to start at `[x y z]`. Optional arguments: - `:scale`: Optional scale factor to apply to each vector's magnitude. Defaults to 1.0. - `:x-range`: 2-vector of the form `[<min-x> <max-x>]` specifying the interval of the first input to `f`. Defaults to the scene's range. - `:y-range`: 2-vector of the form `[<min-y> <max-y>]` specifying the interval of the first input to `f`. Defaults to the scene's range. - `:z-range`: 2-vector of the form `[<min-z> <max-z>]` specifying the interval of the second input to `f`. Defaults to the scene's range. - `:x-samples`: the number of vectors to plot in the `x` direction. Defaults to 10. - `:y-samples`: the number of vectors to plot in the `y` direction. Defaults to 10. - `:z-samples`: the number of vectors to plot in the `z` direction. Defaults to 10. - `:start?` if `true`, renders an arrow at the start of each vector. Defaults to `false`. - `:end?` if `true`, renders an arrow at the end of each vector. Defaults to `true`. - `:arrow-size`: size of the arrows toggled by `:start?` and `:end?`. Defaults to 6. - `:width`: width of each vector. Defaults to 2. - `:opacity`: opacity of each vector. Defaults to 1.0. - `:color`: color of each vector. This can be a `three.js` `Color` object or [any valid input to its constructor](https://threejs.org/docs/#api/en/math/Color). - `:z-order`: z-order of the vector field. - `:z-index`: zIndex of the vector field. Defaults to 0. - `:z-bias`: zBias of the vector field. Defaults to 0.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close