Details

The goal of this package is to be able to get measurements for objects (geometric shapes) as well as plot dimensions. Currently, objects are defined differently depending on the package. Plots, for instance, takes objects in the form of two separate x and y vectors, while Makie uses Polygon objects. The Meshes.jl package uses Ngon objects. Makie Polygon objects currently do not support unitful, so still debating on the best approach there.

The short term goals are:

  • Feature parity with both Makie.jl and Plots.jl
  • Sensible API for the package
  • Meshes.jl integration
  • Measurements for radius or diameter of a circle
  • Angle Measurements

Current Capabilities

There are two main use cases for TapeMeasure currently. One use case is for objects and the other is for a single object. The term object here is specifically for a set of points that define a polygon.

Multiple Objects

When dealing with a set of objects, there are two main functions currently.

These functions will calculate the middle of the each object. This is trivial currently. It is just finding the middle point of the xs and ys of each object (using the middle function from the Statistics package), and then it determines either the horizontal or vertical spacing between the middles of each object. The function will then return a TopDimensions or BottomDimensions object or a LeftDimensions or RightDimensions object that can then be plotted in Plots.jl and Makie.jl. The user can provide an keyword offset value to the functions to change the location of where the dimension will be plotted.

Continuing the example from the Home page

# lets add some vertical spacing between each object as well
for (i, ys) in enumerate(y)
    y[i] = ys .+ (5*i)*ft
end

dims = h_dim(x, y, offset=3ft)

plot(x, y, seriestype=:shape, color=:lightgrey, legend=false, aspectratio=1)
plot!(dims)
Example block output
dims = v_dim(x, y, offset=-3ft)

plot(x, y, seriestype=:shape, color=:lightgrey, legend=false, aspectratio=1)
plot!(dims)
Example block output

Single Object

When dealing with a single object, there are four main functions currently.

These functions attempt to calculate the dimensions of the respective side of the object. These functions are really for rectangular/symetric type objects. The current implementation is limited. The user can provide an keyword offset value to the functions to change the location of where the dimension will be plotted. See example below.

top = dim_top(x[1], y[1], offset=1ft)
bottom = dim_bottom(x[1], y[1])
left = dim_left(x[1], y[1])
right = dim_right(x[1], y[1])

plot(x[1], y[1], seriestype=:shape, color=:lightgrey, legend=false, aspectratio=1)
plot!(top)
plot!(bottom)
plot!(left)
plot!(right)
Example block output

You can see from the plot that the bottom dimension is finding the dimension of the max overall width and not the relative width at the bottom.