-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | QuadEdge structure for representing triangulations -- -- QuadEdge structure for representing triangulations @package QuadEdge @version 0.2 module Data.QuadEdge.Base type Index = Int data Edge a Edge :: EdgeTable -> a -> Edge a edgeTable :: Edge a -> EdgeTable attributes :: Edge a -> a type EdgeRef = (Index, Direction, Orientation) type EdgeTable = (EdgeRef, EdgeRef, EdgeRef, EdgeRef) data Direction Rot0 :: Direction Rot1 :: Direction Rot2 :: Direction Rot3 :: Direction data Orientation Normal :: Orientation Flipped :: Orientation decrDir :: Direction -> Direction incrDir :: Direction -> Direction edgesET :: EdgeTable -> [EdgeRef] emptyET :: Index -> EdgeTable lookupET :: Direction -> EdgeTable -> EdgeRef updateET :: EdgeTable -> Direction -> EdgeRef -> EdgeTable isDual :: EdgeRef -> Bool isPrimal :: EdgeRef -> Bool isFlipped :: EdgeRef -> Bool sym :: EdgeRef -> EdgeRef rotInv :: EdgeRef -> EdgeRef flip :: EdgeRef -> EdgeRef rot :: EdgeRef -> EdgeRef instance Eq Orientation instance Ord Orientation instance Enum Orientation instance Show Orientation instance Read Orientation instance Eq Direction instance Ord Direction instance Enum Direction instance Show Direction instance Read Direction instance Eq a => Eq (Edge a) instance Show a => Show (Edge a) instance Read a => Read (Edge a) -- | The quad-edge data structure is commonly used in computational -- geometry for representing triangulations. It represents simultaneously -- both the map, its dual and mirror image. -- -- The fundamental idea behind the quad-edge structure is the recognition -- that a single edge, in a closed polygonal mesh topology, sits between -- exactly two faces and exactly two vertices. Thus, it can represent a -- dual of the graph simply by reversing the convention on what is a -- vertex and what is a face. -- -- The quad-edge data structure is described in the paper by Leonidas J. -- Guibas and Jorge Stolfi, "Primitives for the manipulation of general -- subdivisions and the computation of Voronoi diagrams", ACM -- Transactions on Graphics, 4(2), 1985, 75-123. -- -- This implementation is based on Stream Fusion and seems to yield -- similar performance to mutable implementations in the ST monad. module Data.QuadEdge type QEDS a = Vector (Maybe (Edge a)) type MQEDS s a = MVector s (Maybe (Edge a)) -- | Create an empty QEDS new :: QEDS a -- | Opens up the QEDS for in-place toplogical modification mutate :: QEDS a -> (forall s. MQEDS s a -> ST s ()) -> QEDS a -- | Create a group of new edges and open up the QEDS mutateNEs :: QEDS a -> [a] -> ([EdgeRef] -> forall s. MQEDS s a -> ST s ()) -> (QEDS a, [EdgeRef]) -- | Create a new edge and open up the QEDS mutateNE :: QEDS a -> a -> (EdgeRef -> forall s. MQEDS s a -> ST s ()) -> (QEDS a, EdgeRef) -- | The QuadEdge splice operator spliceM :: MQEDS s a -> EdgeRef -> EdgeRef -> ST s () -- | Delete an edge while in mutate mode deleteEdgeM :: MQEDS s a -> EdgeRef -> ST s () -- | Return all valid edges in the QEDS edges :: QEDS a -> Vector (Edge a) -- | Return all valid edge references in the QEDS edgerefs :: QEDS a -> Vector EdgeRef -- | Look up an edge. The edge must be valid. getEdge :: QEDS a -> EdgeRef -> Edge a -- | Look up the attributes of an edge. The edge must be valid. getAttr :: QEDS a -> EdgeRef -> a -- | Return a random valid EdgeRef randomEdgeRef :: RandomGen g => QEDS a -> g -> (EdgeRef, g) -- | Check if an EdgeRef points to an active Edge isValid :: QEDS a -> EdgeRef -> Bool updateEdge :: QEDS a -> EdgeRef -> Edge a -> QEDS a updateAttr :: QEDS a -> EdgeRef -> a -> QEDS a -- | Delete a set of edges in one pass, using mutate and deleteEdgeM deleteEdges :: QEDS a -> Stream EdgeRef -> QEDS a makeEdges :: QEDS a -> Stream a -> (QEDS a, Stream EdgeRef) makeEdge :: QEDS a -> a -> (QEDS a, EdgeRef) -- | Returns a stream of adjacent edges using the given Adjacency Operator ring :: QEDS a -> (QEDS a -> EdgeRef -> EdgeRef) -> EdgeRef -> (Stream EdgeRef) -- | CCW around the origin onext :: QEDS a -> EdgeRef -> EdgeRef -- | CW around the origin oprev :: QEDS a -> EdgeRef -> EdgeRef -- | CCW around the left face lnext :: QEDS a -> EdgeRef -> EdgeRef -- | CW around the left face lprev :: QEDS a -> EdgeRef -> EdgeRef -- | CCW around the right face rnext :: QEDS a -> EdgeRef -> EdgeRef -- | CW around the right face rprev :: QEDS a -> EdgeRef -> EdgeRef -- | CCW around the destination dnext :: QEDS a -> EdgeRef -> EdgeRef -- | CW around the destination dprev :: QEDS a -> EdgeRef -> EdgeRef comp :: (EdgeRef -> a) -> (b -> EdgeRef) -> QEDS d -> b -> a oprevM :: MQEDS s a -> EdgeRef -> ST s EdgeRef lnextM :: MQEDS s a -> EdgeRef -> ST s EdgeRef lprevM :: MQEDS s a -> EdgeRef -> ST s EdgeRef rnextM :: MQEDS s a -> EdgeRef -> ST s EdgeRef rprevM :: MQEDS s a -> EdgeRef -> ST s EdgeRef dnextM :: MQEDS s a -> EdgeRef -> ST s EdgeRef dprevM :: MQEDS s a -> EdgeRef -> ST s EdgeRef onextM :: MQEDS s a -> EdgeRef -> ST s EdgeRef compM :: (EdgeRef -> b) -> (t -> EdgeRef) -> MQEDS s a -> t -> ST s b