I’m looking into rewriting parts of my VoronoiCells package. One thing I want to do is to have a type `Rectangle`

and make functions that maps points between two Rectangles.

This attempt appears to work:

```
struct Rectangle
Left::Float64
Right::Float64
Lower::Float64
Upper::Float64
end
left(r::Rectangle) = r.Left
right(r::Rectangle) = r.Right
lower(r::Rectangle) = r.Lower
upper(r::Rectangle) = r.Upper
function construct_rectangle_map(from::Rectangle, to::Rectangle)
function rect_map(p::GeometricalPredicates.Point2D)
GeometricalPredicates.Point2D(
left(to) + (getx(p) - left(from)) / (right(from) - left(from)) * (right(to) - left(to)),
lower(to) + (gety(p) - lower(from)) / (upper(from) - lower(from)) * (upper(to) - lower(to))
)
end
end
```

The `getx`

and `gety`

are from the GeometricalPredicates package.

With `from = Rectangle(-1, 1, 0, 1)`

and `to = VoronoiCells.Rectangle(1, 2, 1, 2)`

I get a map `m = construct_rectangle_map(from, to)`

that seems to work: `m(Point2D(0.3, 0.4))`

However, looking at `@code_lowered m(Point2D(0.3, 0.4))`

it appears that the the `left`

/`right`

are called inside the function.

I think it would be nice if the numbers are saved as the constants they are for a given map. Does anyone know how to do this?

Thanks!