gonum / gonum/exp

rings: add replacement for Lens type

Open
#15 0 comments 0 reactions 1 assignee Claimed by @kortschak View on GitHub
Dominant language
Go
Stars
19
Forks
7
PR merge metrics
No merged PRs in 30d

Description

The design intention for the `Lens` type in the rings package was to allow users to selectively magnify regions of the plot. This has benefits in genomics plotting and also in highly differentially dense graph plots. The approach was to provide a shim arc that adjusted the circumferential coordinates of arcs places on top of it. This was not properly wired through all the types that would need to know about it.

I still think this is a useful addition to the package, but I think a better approach would be to add an interface type:
```
// Lens modifies an Arc to allow it to adjust the magnification of regions of itself.
type Lens interface {
// Focus returns a change in position for a given angle.
// The returned delta must not result in an angle outside
// the receiver's arc.
Focus(theta Angle) (delta Angle)
}
```

With this change arcs that are being plotted onto will be queried for satisfaction of `Lens` and have the angular coordinates adjusted by the returned delta.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.