start redoing projections?
This commit is contained in:
parent
f8eacc5904
commit
d5a141f4b8
2 changed files with 34 additions and 0 deletions
10
engine/hexprisms.go
Normal file
10
engine/hexprisms.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
type HexPrismMap struct {
|
||||||
|
Map map[Point3]*HexPrism
|
||||||
|
}
|
||||||
|
|
||||||
|
type HexPrism struct {
|
||||||
|
pos Point3
|
||||||
|
hpm *HexPrismMap
|
||||||
|
}
|
24
engine/projection.go
Normal file
24
engine/projection.go
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package engine
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Oblique projections
|
||||||
|
CabinetProjection = ParallelProjection{0.5, 0.5}
|
||||||
|
CavalierProjection = ParallelProjection{1, 1}
|
||||||
|
|
||||||
|
// Axonometric projections
|
||||||
|
DimetricProjection = ParallelProjection{0, 0.5}
|
||||||
|
ElevationProjection = ParallelProjection{0, 0}
|
||||||
|
IsometricProjection = ParallelProjection{0, 0.707106781186548} // 1 ÷ √2
|
||||||
|
TrimetricProjection = ParallelProjection{0, 1}
|
||||||
|
HexPrismProjection = ParallelProjection{0, 0.816496580927726} // √2 ÷ √3
|
||||||
|
)
|
||||||
|
|
||||||
|
type ParallelProjection struct {
|
||||||
|
ZX, ZY float64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (π ParallelProjection) Project(p Point3) (px, py float64) {
|
||||||
|
px = float64(p.X) + π.ZX*float64(p.Z)
|
||||||
|
py = float64(p.Y) + π.ZY*float64(p.Z)
|
||||||
|
return px, py
|
||||||
|
}
|
Loading…
Reference in a new issue