off-simple-0.1: A parser for simplified-syntax OFF files

Graphics.Formats.OFF.Simple

Description

A simple datatype and parser for 3D OFF files. A single type is used for OFF information with or without color. Loosely based on http://people.sc.fsu.edu/~jburkardt/data/off/off.html, but uses the file header to determine whether the object's faces contain color values.

Synopsis

Documentation

data OFF Source

Representation of an object in OFF format; a pair of vectors containing the vertices and the faces of the object.

Constructors

OFF 

Fields

vertices :: Vector Vertex
 
faces :: Vector Face
 

Instances

data Face Source

A face is a vector of vertex indices and an optional color value.

Constructors

Face (Vector Int) (Maybe Color) 

Instances

vertexCount :: OFF -> IntSource

The number of vertices in an OFF object.

faceCount :: OFF -> IntSource

The number of faces in an OFF object.

hasColor :: OFF -> BoolSource

Returns True if the OFF object has color values associated with its faces.

parseOFF :: Parser OFFSource

Parse a Text string representing an OFF object.

readOFFFile :: FilePath -> IO (Either ParseError OFF)Source

Read an OFF object from the given FilePath, returning either the corresponding OFF value or a ParseError.