visibility

package
v0.0.0-...-883d5d7 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Segment

type Segment[T constraints.Float] struct {
	Start geom.Point[T]
	End   geom.Point[T]
}

Segment holds the start and end points of a line.

func (Segment[T]) Bounds

func (s Segment[T]) Bounds() geom.Rect[T]

Bounds returns the bounding rectangle of this Segment. This includes a slight bit of expansion to compensate for floating-point imprecision.

type Segment32

type Segment32 = Segment[float32]

Segment32 is an alias for the float32 version of Segment.

type Segment64

type Segment64 = Segment[float64]

Segment64 is an alias for the float64 version of Segment.

type Visibility

type Visibility[T constraints.Float] struct {
	// contains filtered or unexported fields
}

Visibility holds state for computing a visibility polygon.

func New

func New[T constraints.Float](bounds geom.Rect[T], obstructions []Segment[T], hasNoIntersections bool) *Visibility[T]

New creates a Visibility object. If the obstructions do not intersect each other, pass in true for hasNoIntersections to eliminate the costly pass to break the segments up into smaller parts.

func (*Visibility[T]) SetViewPoint

func (v *Visibility[T]) SetViewPoint(viewPt geom.Point[T]) poly.Polygon[T]

SetViewPoint sets a view point and generates a polygon with the unobstructed visible area.

Jump to

Keyboard shortcuts

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