MCPcopy Index your code
hub / github.com/tdewolff/canvas / FindPrevNext

Method FindPrevNext

path_intersection.go:839–852  ·  view source on GitHub ↗

func (s *SweepStatus) First() *SweepNode { if s.root == nil { return nil } n := s.root for n.left != nil { n = n.left } return n } func (s *SweepStatus) Last() *SweepNode { if s.root == nil { return nil } n := s.root for n.right != nil { n = n.right } return n } Find returns the

(item *SweepPoint)

Source from the content-addressed store, hash-verified

837//}
838
839func (s *SweepStatus) FindPrevNext(item *SweepPoint) (*SweepNode, *SweepNode) {
840 if s.root == nil {
841 return nil, nil
842 }
843
844 n, cmp := s.find(item)
845 if cmp < 0 {
846 return n.Prev(), n
847 } else if 0 < cmp {
848 return n, n.Next()
849 } else {
850 return n.Prev(), n.Next() // should never happen
851 }
852}
853
854//func (s *SweepStatus) Insert(item *SweepPoint) *SweepNode {
855// if s.root == nil {

Callers 2

bentleyOttmannFunction · 0.95
relateFunction · 0.95

Calls 3

findMethod · 0.95
PrevMethod · 0.80
NextMethod · 0.45

Tested by

no test coverage detected