Fix ascii diagram and remove unused code
This commit is contained in:
parent
a64d87eb61
commit
d91ace98ec
2 changed files with 18 additions and 19 deletions
|
|
@ -171,7 +171,6 @@ func NewShape(shapeType string, box *geo.Box) Shape {
|
||||||
// │
|
// │
|
||||||
// │
|
// │
|
||||||
// ▼
|
// ▼
|
||||||
//
|
|
||||||
// ┌────r─────────────────────────┐
|
// ┌────r─────────────────────────┐
|
||||||
// │ │
|
// │ │
|
||||||
// │ │ │
|
// │ │ │
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package shape
|
package shape
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/lib/geo"
|
"oss.terrastruct.com/d2/lib/geo"
|
||||||
"oss.terrastruct.com/d2/lib/svg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type shapeDoubleCircle struct {
|
type shapeDoubleCircle struct {
|
||||||
|
|
@ -18,20 +19,19 @@ func NewDoubleCircle(box *geo.Box) Shape {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func doubleCirclePath(box *geo.Box) *svg.SvgPathContext {
|
func (s shapeDoubleCircle) AspectRatio1() bool {
|
||||||
// halfYFactor := 43.6 / 87.3
|
return true
|
||||||
pc := svg.NewSVGPathContext(box.TopLeft, box.Width, box.Height)
|
}
|
||||||
pc.StartAt(pc.Absolute(0.25, 0))
|
|
||||||
// pc
|
func (s shapeDoubleCircle) GetDimensionsToFit(width, height, padding float64) (float64, float64) {
|
||||||
return pc
|
radius := math.Ceil(math.Sqrt(math.Pow(width/2, 2)+math.Pow(height/2, 2))) + padding
|
||||||
|
return radius * 2, radius * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s shapeDoubleCircle) GetInsidePlacement(width, height, padding float64) geo.Point {
|
||||||
|
return *geo.NewPoint(s.Box.TopLeft.X+math.Ceil(s.Box.Width/2-width/2), s.Box.TopLeft.Y+math.Ceil(s.Box.Height/2-height/2))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s shapeDoubleCircle) Perimeter() []geo.Intersectable {
|
func (s shapeDoubleCircle) Perimeter() []geo.Intersectable {
|
||||||
return doubleCirclePath(s.Box).Path
|
return []geo.Intersectable{geo.NewEllipse(s.Box.Center(), s.Box.Width/2, s.Box.Height/2)}
|
||||||
}
|
|
||||||
|
|
||||||
func (s shapeDoubleCircle) GetSVGPathData() []string {
|
|
||||||
return []string{
|
|
||||||
doubleCirclePath(s.Box).PathData(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue