sweepline

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: LGPL-2.1 Imports: 3 Imported by: 0

Documentation

Overview

Package sweepline Contains struct which implement a sweepline algorithm for scanning geometric data structures.

Index

Constants

View Source
const (
	InsertStatus = iota + 1
	DeleteStatus
)

Sweepline const parameter.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoordinatesOverlapAction

type CoordinatesOverlapAction struct {
}

CoordinatesOverlapAction ...

func (*CoordinatesOverlapAction) Overlap

func (c *CoordinatesOverlapAction) Overlap(s0, s1 *Interval) bool

Overlap ...

type Event

type Event struct {
	InsertEvent      *Event // null if this is an INSERT event
	DeleteEventIndex int

	SweepInt *Interval
	// contains filtered or unexported fields
}

Event ...

func NewEvent

func NewEvent(x float64, insertEvent *Event, sweepInt *Interval) *Event

NewEvent create a default NewEvent.

func (*Event) Compare

func (s *Event) Compare(pe *Event) int

Compare ProjectionEvents are ordered first by their x-value, and then by their eventType.

It is important that Insert events are sorted before Delete events, so that
items whose Insert and Delete events occur at the same x-value will be correctly handled.

func (*Event) IsDelete

func (s *Event) IsDelete() bool

IsDelete ...

func (*Event) IsInsert

func (s *Event) IsInsert() bool

IsInsert ...

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index A sweepline implements a sorted index on a set of intervals. It is used to compute all overlaps between the interval in the index.

func (*Index) Add

func (s *Index) Add(sweepInt *Interval)

Add ...

func (*Index) ComputeOverlaps

func (s *Index) ComputeOverlaps(action OverlapAction)

ComputeOverlaps compute overlaps.

type Interval

type Interval struct {
	Min, Max float64
	Item     *matrix.LineSegment
}

Interval ...

type LineEvents

type LineEvents []*Event

LineEvents ...

func (LineEvents) Len

func (it LineEvents) Len() int

Len ...

func (LineEvents) Less

func (it LineEvents) Less(i, j int) bool

Less ...

func (LineEvents) Swap

func (it LineEvents) Swap(i, j int)

Swap ...

type OverlapAction

type OverlapAction interface {
	Overlap(s0, s1 *Interval) bool
}

OverlapAction An action taken when a SweepLineIndex detects that two Interval.

Jump to

Keyboard shortcuts

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