Skip to content

jsl/geometry/basics

Package name: jsl/geometry/basics

Summary

General Definitions

Function Description
contains? Is B entirely enclosed by A ?
RoundedRectangle
to-radius Diameter to Radius Converter
compute-circle Given 3 Points - compute the circle
GeneralRoundedRectangle (+ 1)
scale-union Recursively scale the shapes of a Union
scale-pts
Capsule
ChamferedRectangle
Rectangle
scale-pose
bounds Compute the bounding Dims object that encapsulates the sequence of passed Dims.
GeneralChamferedRectangle (+ 1)
expand (+ 1) Increase the size of a Dims by amount on all sides
expand-union Expand for Union shapes
DShape
scale-shape Scale a Shape by a factor
to-point

Definitions

General Definitions

contains?

Is B entirely enclosed by A ?

public defn contains? (a:Dims, b:Dims) -> True|False

  • Returns True|False

RoundedRectangle

public defn RoundedRectangle (size:Dims, r:Double -- anchor:Anchor = ?)

to-radius

Diameter to Radius Converter

public defn to-radius (diam:Double) -> Double

  • Returns Double

compute-circle

Given 3 Points - compute the circle

public defn compute-circle (b:Point, e:Point, c:Point) -> Circle

  • Returns Circle

See here: https://math.stackexchange.com/questions/2836274/3-point-to-circle-and-get-radius

GeneralRoundedRectangle

public defn GeneralRoundedRectangle (size:Dims, r:Double, m:CornerModifier -- anchor:Anchor = ?)

GeneralRoundedRectangle

public defn GeneralRoundedRectangle (size:Dims, r:Tuple<Double> -- anchor:Anchor = ?)

scale-union

Recursively scale the shapes of a Union

public defn scale-union (x:Shape|Union, scale:Double) -> Shape

  • Returns Shape

scale-pts

public defn scale-pts (pts:Tuple<Point>, scale:Double) -> Tuple<Point>

  • Returns Tuple<Point>

Capsule

public defn Capsule (size:Dims -- anchor:Anchor = ?)

ChamferedRectangle

public defn ChamferedRectangle (size:Dims, r:Double -- anchor:Anchor = ?)

Rectangle

public defn Rectangle (size:Dims -- anchor:Anchor = ?, pose:Pose = ?)

scale-pose

public defn scale-pose (p:Pose, scale:Double) -> Pose

  • Returns Pose

bounds

Compute the bounding Dims object that encapsulates the sequence of passed Dims.

public defn bounds (objs:Collection<Dims> -- expand-by:Double = ?) -> Dims

  • objs: Collection<Dims> - The set of objects that will be reviewed.
  • expand-by: Double - Add additional margin on all sides by this amount. The resultant Dims object will be 2.0 * expand-by greater than the maximum outline Default value is 0.0.
  • Returns Dims

GeneralChamferedRectangle

public defn GeneralChamferedRectangle (size:Dims, r:Double, m:CornerModifier -- anchor:Anchor = ?)

GeneralChamferedRectangle

public defn GeneralChamferedRectangle (size:Dims, r:Tuple<Double> -- anchor:Anchor = ?)

expand

Increase the size of a Dims by amount on all sides

public defn expand (d:Dims, amount:Double) -> Dims

  • d: Dims - Originating Dims instance that this method will expand.
  • amount: Double - quantity for expansion on all sides.
  • Returns Dims

Effective width and height are larger by 2.0 * amount

expand

Increase the size of a Dims by different x and y amounts.

public defn expand (d:Dims, amount:Dims) -> Dims

  • d: Dims - Originating Dims instance that this method will expand.
  • amount: Dims - Dims that encodes the expansion amount of the X and Y axis as two different values.
  • Returns Dims

expand-union

Expand for Union shapes

public defn expand-union (x:Shape|Union, amount:Double) -> Shape

  • Returns Shape

This is provides an implementation that supports Union by recursively applying the expand operation on all shapes in the Union.

DShape

public defn DShape (size:Dims, r:Double -- anchor:Anchor = ?)

scale-shape

Scale a Shape by a factor

public defn scale-shape (s:Shape, scale:Double) -> Shape

  • Returns Shape

Scale in X/Y by factor scale

to-point

public defn to-point (pt:Point|[Double, Double]|[Int, Int]) -> Point

  • Returns Point