relpos

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package relpos defines a position relationship among layers, in terms of X,Y width and height of layer and associated position within a given X-Y plane, and Z vertical stacking of layers above and below each other.

Index

Constants

This section is empty.

Variables

View Source
var KiT_Relations = kit.Enums.AddEnum(RelationsN, false, nil)
View Source
var KiT_XAligns = kit.Enums.AddEnum(XAlignsN, false, nil)
View Source
var KiT_YAligns = kit.Enums.AddEnum(YAlignsN, false, nil)

Functions

This section is empty.

Types

type Rel

type Rel struct {
	Rel    Relations `desc:"spatial relationship between this layer and the other layer"`
	XAlign XAligns   `viewif:"Rel=FrontOf,Behind,Above,Below" desc:"horizontal (x-axis) alignment relative to other"`
	YAlign YAligns   `viewif:"Rel=LeftOf,RightOf,Above,Below" desc:"vertical (y-axis) alignment relative to other"`
	Other  string    `desc:"name of the other layer we are in relationship to"`
	Scale  float32   `desc:"scaling factor applied to layer size for displaying"`
	Space  float32   `desc:"number of unit-spaces between us"`
	Offset float32   `desc:"for alignment, amount we are offset relative to perfect alignment"`
}

Rel defines a position relationship among layers, in terms of X,Y width and height of layer and associated position within a given X-Y plane, and Z vertical stacking of layers above and below each other.

func (*Rel) AlignXPos

func (rp *Rel) AlignXPos(xop, xosz, xsz float32) float32

AlignXPos returns the X-axis (within-plane horizontal or width) position according to alignment factors

func (*Rel) AlignYPos

func (rp *Rel) AlignYPos(yop, yosz, ysz float32) float32

AlignYPos returns the Y-axis (within-plane vertical or height) position according to alignment factors

func (*Rel) Defaults

func (rp *Rel) Defaults()

Defaults sets default scale, space, offset values -- rel, align must be set specifically These are automatically applied if Scale = 0

func (*Rel) Pos

func (rp *Rel) Pos(op mat32.Vec3, osz mat32.Vec2, sz mat32.Vec2) mat32.Vec3

Pos returns the relative position compared to other position and size, based on settings osz and sz must both have already been scaled by relevant Scale factor

type Relations

type Relations int

Relations are different spatial relationships (of layers)

const (
	NoRel Relations = iota
	RightOf
	LeftOf
	Behind
	FrontOf
	Above
	Below

	RelationsN
)

The relations

func (*Relations) FromString

func (i *Relations) FromString(s string) error

func (Relations) MarshalJSON

func (ev Relations) MarshalJSON() ([]byte, error)

func (Relations) String

func (i Relations) String() string

func (*Relations) UnmarshalJSON

func (ev *Relations) UnmarshalJSON(b []byte) error

type XAligns

type XAligns int

XAligns are different horizontal alignments

const (
	Left XAligns = iota
	Middle
	Right

	XAlignsN
)

func (*XAligns) FromString

func (i *XAligns) FromString(s string) error

func (XAligns) MarshalJSON

func (ev XAligns) MarshalJSON() ([]byte, error)

func (XAligns) String

func (i XAligns) String() string

func (*XAligns) UnmarshalJSON

func (ev *XAligns) UnmarshalJSON(b []byte) error

type YAligns

type YAligns int

YAligns are different vertical alignments

const (
	Front YAligns = iota
	Center
	Back

	YAlignsN
)

func (*YAligns) FromString

func (i *YAligns) FromString(s string) error

func (YAligns) MarshalJSON

func (ev YAligns) MarshalJSON() ([]byte, error)

func (YAligns) String

func (i YAligns) String() string

func (*YAligns) UnmarshalJSON

func (ev *YAligns) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL