Showing preview only (1,462K chars total). Download the full file or copy to clipboard to get everything.
Repository: dgpdec/course
Branch: master
Commit: 9f29f075989e
Files: 393
Total size: 59.4 MB
Directory structure:
gitextract_rojb_la7/
├── .gitignore
├── BaseCode/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Connection/
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── Direction.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── HarmonicBases.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── TreeCotree.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Elasticity/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── .Elasticity.h.swo
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── PolarDecomposition2x2.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Fairing/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Flatten/
│ ├── .viewer_state.txt
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ ├── main.cpp
│ └── qcError.cpp
├── Geodesics/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── HOWTO
├── Hot2/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
└── Slides/
├── apps-siggraph2013.key
└── theory-siggraph2013.key
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_Store
*.o
*.swp
Flatten/Makefile
Flatten/flatten
================================================
FILE: BaseCode/.viewer_state.txt
================================================
0.126663
-0.0243652
-0.989174
0.0699843
815
767
================================================
FILE: BaseCode/Makefile
================================================
##########################################################################################
# Specify library locations here (add or remove "#" marks to comment/uncomment lines for your platform)
# Mac OS X
DDG_INCLUDE_PATH =
DDG_LIBRARY_PATH =
DDG_BLAS_LIBS = -framework Accelerate
DDG_SUITESPARSE_LIBS = -lspqr -lumfpack -lcholmod -lmetis -lcolamd -lccolamd -lcamd -lamd -ltbb -lm -lsuitesparseconfig
DDG_OPENGL_LIBS = -framework OpenGL -framework GLUT
# # Linux
# DDG_INCLUDE_PATH =
# DDG_LIBRARY_PATH =
# DDG_BLAS_LIBS = -llapack -lblas -lgfortran
# DDG_SUITESPARSE_LIBS = -lspqr -lcholmod -lmetis -lcolamd -lccolamd -lcamd -lamd -lm
# DDG_OPENGL_LIBS = -lglut -lGL -lGLU -lX11
# # Windows / Cygwin
# DDG_INCLUDE_PATH = -I/usr/include/opengl -I/usr/include/suitesparse
# DDG_LIBRARY_PATH = -L/usr/lib/w32api -L/usr/lib/suitesparse
# DDG_BLAS_LIBS = -llapack -lblas
# DDG_SUITESPARSE_LIBS = -lspqr -lcholmod -lcolamd -lccolamd -lcamd -lamd -lm
# DDG_OPENGL_LIBS = -lglut32 -lglu32 -lopengl32
########################################################################################
TARGET = ddg
CC = g++
LD = g++
CFLAGS = -O3 -Wall -Werror -ansi -pedantic $(DDG_INCLUDE_PATH) -I./include -I./src
LFLAGS = -O3 -Wall -Werror -ansi -pedantic $(DDG_LIBRARY_PATH)
LIBS = $(DDG_OPENGL_LIBS) $(DDG_SUITESPARSE_LIBS) $(DDG_BLAS_LIBS)
########################################################################################
## !! Do not edit below this line
HEADERS := $(wildcard include/*.h)
SOURCES := $(wildcard src/*.cpp)
OBJECTS := $(addprefix obj/,$(notdir $(SOURCES:.cpp=.o)))
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(LD) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LFLAGS) $(LIBS)
obj/%.o: src/%.cpp ${HEADERS}
$(CC) -c $< -o $@ $(CFLAGS)
clean:
rm -f $(OBJECTS)
rm -f $(TARGET)
rm -f $(TARGET).exe
================================================
FILE: BaseCode/include/Application.h
================================================
#ifndef DDG_APPLICATION_H
#define DDG_APPLICATION_H
namespace DDG
{
class Application
{
//
// TODO: add your code here!!!
//
};
}
#endif
================================================
FILE: BaseCode/include/Camera.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Camera.h
// -----------------------------------------------------------------------------
//
// Camera is used by Viewer to keep track of the view state; it also
// handles mouse input related to camera manipulation.
//
#ifndef DDG_CAMERA_H
#define DDG_CAMERA_H
#include "Quaternion.h"
#ifdef __CYGWIN__
#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#else
#include <GLUT/glut.h>
#endif
namespace DDG
{
class Camera
{
public:
Camera( void );
// constructor
Quaternion clickToSphere( int x, int y );
// projects a mous click onto the unit sphere
void setView( void ) const;
// applies the camera transformation to the OpenGL modelview stack
void mouse( int button, int state, int x, int y );
// handles mouse clicks
void motion( int x, int y );
// handles mouse drags
void idle( void );
// handles camera momentum
void zoomIn( void );
// moves viewer toward object
void zoomOut( void );
// moves viewer away from object
Quaternion currentRotation( void ) const;
// returns the rotation corresponding to the current mouse state
Quaternion pClick;
// mouse coordinates of current click
Quaternion pDrag;
// mouse coordinates of current drag
Quaternion pLast;
// mouse coordinates of previous drag
Quaternion rLast;
// previous camera rotation
Quaternion momentum;
// camera momentum
int tLast;
// time of previous drag
double zoom, vZoom;
// zoom and zoom velocity
};
}
#endif
================================================
FILE: BaseCode/include/Complex.h
================================================
#ifndef DDG_COMPLEX_H
#define DDG_COMPLEX_H
#include <iosfwd>
namespace DDG
{
class Complex
{
public:
Complex( double a=0., double b=0. );
// constructs number a+bi
void operator+=( const Complex& z );
// add z
void operator-=( const Complex& z );
// subtract z
void operator*=( const Complex& z );
// Complex multiply by z
void operator*=( double r );
// scalar multiply by r
void operator/=( double r );
// scalar divide by r
void operator/=( const Complex& z );
// complex divide by r
Complex operator-( void ) const;
// returns the additive inverse
Complex conj( void ) const;
// returns Complex conjugate
Complex inv( void ) const;
// returns inverse
double arg( void ) const;
// returns argument
double norm( void ) const;
// returns norm
double norm2( void ) const;
// returns norm squared
Complex unit( void ) const;
// returns complex number with unit norm and same modulus
Complex exponential( void ) const;
// complex exponentiation
double re;
// real part
double im;
// imaginary part
};
Complex operator+( const Complex& z1, const Complex& z2 );
// binary addition
Complex operator-( const Complex& z1, const Complex& z2 );
// binary subtraction
Complex operator*( const Complex& z1, const Complex& z2 );
// binary Complex multiplication
Complex operator*( const Complex& z, double r );
// right scalar multiplication
Complex operator*( double r, const Complex& z );
// left scalar multiplication
Complex operator/( const Complex& z, double r );
// scalar division
Complex operator/( const Complex& z1, const Complex& z2 );
// complex division
double dot( const Complex& z1, const Complex& z2 );
// inner product
double cross( const Complex& z1, const Complex& z2 );
// cross product
std::ostream& operator<<( std::ostream& os, const Complex& o );
// prints components
}
#endif
================================================
FILE: BaseCode/include/DenseMatrix.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- DenseMatrix.h
// -----------------------------------------------------------------------------
//
// DenseMatrix represents an m by n (real or complex) matrix where every
// entry -- including zero-valued entries -- is stored explicitly. This
// class is most commonly used to represent dense vectors in sparse linear
// systems (i.e., the right hand side and the solution vector).
//
// A real or complex matrix is allocated via
//
// DenseMatrix A( m, n );
// DenseMatrix A( m, n, entryComplex );
//
// Matrix elements are then accessed using parenthesis, e.g.,
//
// A(i,j) = 1;
// A(i,j) += 2;
// a = A(i,j);
//
// etc.
//
// DenseMatrix is interoperable with the SuiteSparse numerical linear algebra
// library. In particular, dereferencing a DenseMatrix returns a cholmod_dense*
// which can be used by routines in SuiteSparse. For basic operations, however,
// you should not need to access this pointer explicitly -- see the solve()
// method in SparseMatrix.h.
//
#ifndef DDG_DENSEMATRIX_H
#define DDG_DENSEMATRIX_H
#include <cholmod.h>
#include "Types.h"
#include <vector>
namespace DDG
{
enum NormType
{
lInfinity,
lOne,
lTwo
};
template <class T>
class DenseMatrix
{
public:
DenseMatrix( int m = 0, int n = 1 );
// initialize an mxn matrix (specifying just m yields a column vector)
DenseMatrix( const DenseMatrix<T>& A );
// copy constructor
const DenseMatrix<T>& operator=( const DenseMatrix<T>& B );
// copies B
~DenseMatrix( void );
// destructor
SparseMatrix<T> sparse( void );
// converts to a sparse matrix
int nRows( void ) const;
// returns the number of rows
int nColumns( void ) const;
// returns the number of columns
int length( void ) const;
// returns the size of the largest dimension
void zero( const T& val = 0. );
// sets all elements to val
double norm( NormType type = lInfinity ) const;
// returns the maximum magnitude of any entry
T& operator()( int row, int col );
T operator()( int row, int col ) const;
// access the specified element of the matrix (uses 0-based indexing)
T& operator()( int index );
T operator()( int index ) const;
// access the specified element of a vector (uses 0-based indexing)
DenseMatrix<T> transpose( void ) const;
// returns the transpose of this matrix
DenseMatrix<T> operator*( const DenseMatrix<T>& B ) const;
// returns product of this matrix with B
void operator*=( const T& c );
// multiplies this matrix by the scalar c
void operator/=( const T& c );
// divides this matrix by the scalar c
DenseMatrix operator+( const DenseMatrix& B ) const;
// returns sum of this matrix with B
void operator+=( const DenseMatrix& B );
// adds B to this matrix
DenseMatrix operator-( const DenseMatrix& B ) const;
// returns difference of this matrix with B
void operator-=( const DenseMatrix& B );
// subtracts B from this matrix
DenseMatrix<T> operator-( void ) const;
// returns additive inverse of this matrix
cholmod_dense* to_cholmod( void );
// returns pointer to copy of matrix in CHOLMOD format
const DenseMatrix<T>& operator=( cholmod_dense* B );
// copies a cholmod_dense* into a DenseMatrix;
// takes responsibility for deallocating B
void normalize( void );
// divides by Frobenius norm
T sum( void ) const;
// returns the sum of all entries
void removeMean( void );
// removes the mean
void randomize( void );
// replaces entries with uniformly distributed random real numbers in the interval [-1,1]
protected:
int m, n;
std::vector<T> data;
cholmod_dense* cData;
};
template <class T>
DenseMatrix<T> operator*( const DenseMatrix<T>& A, const T& c );
// right scalar multiplication
template <class T>
DenseMatrix<T> operator*( const T& c, const DenseMatrix<T>& A );
// left scalar multiplication
template <class T>
DenseMatrix<T> operator/( const DenseMatrix<T>& A, const T& c );
// scalar division
template <class T>
T dot( const DenseMatrix<T>& x, const DenseMatrix<T>& y );
// returns Euclidean inner product of x and y
template <class T>
std::ostream& operator << (std::ostream& os, const DenseMatrix<T>& o);
// prints entries
template <class T>
T inner( const DenseMatrix<T>& x,
const DenseMatrix<T>& y );
// standard inner product
template <class T>
T inner( const DenseMatrix<T>& x,
const DenseMatrix<T>& B,
const DenseMatrix<T>& y );
// inner product with respect to a diagonal inner
// product B represented as a dense vector
}
#include "DenseMatrix.inl"
#endif
================================================
FILE: BaseCode/include/DiscreteExteriorCalculus.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- DiscreteExteriorCalculus.h
// -----------------------------------------------------------------------------
//
// Static methods for building the fundamental discrete operators (exterior
// derivative, Hodge star) for 0-, 1-, and 2-forms on a surface mesh. Methods
// are templated on entry type, i.e., one can build either real- or complex-
// matrices using the types DDG::Real and DDG::Complex, respectively. For
// instance, to build the usual Laplacian on functions, one could write
//
// Mesh mesh;
// SparseMatrix d0, star0, star1, Delta;
//
// ExteriorDerivative0Form::build( mesh, d0 );
// HodgeStar0Form::build( mesh, star0 );
// HodgeStar1Form::build( mesh, star1 );
// Delta = star0.inverse() * d0.transpose() * star1 * d0;
//
#ifndef DDG_DISCRETEEXTERIORCALCULUS_H
#define DDG_DISCRETEEXTERIORCALCULUS_H
#include "Mesh.h"
#include "SparseMatrix.h"
namespace DDG
{
template< class T > struct HodgeStar0Form { static void build( const Mesh& mesh, SparseMatrix<T>& star0 ); };
template< class T > struct HodgeStar1Form { static void build( const Mesh& mesh, SparseMatrix<T>& star1 ); };
template< class T > struct HodgeStar2Form { static void build( const Mesh& mesh, SparseMatrix<T>& star2 ); };
template< class T > struct ExteriorDerivative0Form { static void build( const Mesh& mesh, SparseMatrix<T>& d0 ); };
template< class T > struct ExteriorDerivative1Form { static void build( const Mesh& mesh, SparseMatrix<T>& d1 ); };
}
#include "DiscreteExteriorCalculus.inl"
#endif
================================================
FILE: BaseCode/include/Edge.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Edge.h
// -----------------------------------------------------------------------------
//
// Edge stores attributes associated with a mesh edge. The iterator he points
// to one of its two associated halfedges. (See the documentation for a more
// in-depth discussion of the halfedge data structure.)
//
#ifndef DDG_EDGE_H
#define DDG_EDGE_H
#include "Types.h"
namespace DDG
{
class Edge
{
public:
HalfEdgeIter he;
// points to one of the two halfedges associated with this edge
int index;
// unique integer ID in the range 0, ..., nEdges-1
Edge() : index(0) { }
};
}
#endif
================================================
FILE: BaseCode/include/Face.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Face.h
// -----------------------------------------------------------------------------
//
// Face stores attributes associated with a mesh edge. The iterator he points
// to one of its associated halfedges. (See the documentation for a more
// in-depth discussion of the halfedge data structure.)
//
#ifndef DDG_FACE_H
#define DDG_FACE_H
#include "Types.h"
namespace DDG
{
class Face
{
public:
HalfEdgeIter he;
// points to one of the halfedges associated with this face
int index;
// unique integer ID in the range 0, ..., nFaces-1
Face() : index(0) { }
bool isBoundary( void ) const;
// returns true if this face corresponds to a
// boundary loop; false otherwise
double area( void ) const;
// returns the triangle area
Vector normal( void ) const;
// returns the unit normal associated with this face; normal
// orientation is determined by the circulation order of halfedges
Vector circumcenter( void ) const;
// returns triangle circumcenter
Vector barycenter( void ) const;
// returns triangle barycenter
};
}
#endif
================================================
FILE: BaseCode/include/HalfEdge.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- HalfEdge.h
// -----------------------------------------------------------------------------
//
// HalfEdge is used to define mesh connectivity. (See the documentation for a
// more in-depth discussion of the halfedge data structure.)
//
#ifndef DDG_HALFEDGE_H
#define DDG_HALFEDGE_H
#include "Vector.h"
#include "Types.h"
namespace DDG
{
class HalfEdge
{
public:
HalfEdgeIter next;
// points to the next halfedge around the current face
HalfEdgeIter flip;
// points to the other halfedge associated with this edge
VertexIter vertex;
// points to the vertex at the "tail" of this halfedge
EdgeIter edge;
// points to the edge associated with this halfedge
FaceIter face;
// points to the face containing this halfedge
bool onBoundary;
// true if this halfedge is contained in a boundary
// loop; false otherwise
Vector texcoord;
// texture coordinates associated with the triangle corner at the
// "tail" of this halfedge
double cotan( void ) const;
// returns the cotangent of the angle opposing this edge
Vector rotatedEdge( void ) const;
// returns oriented edge vector rotated by PI/2 around face normal
// if onBoundary, then return nil
};
}
#endif
================================================
FILE: BaseCode/include/Image.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Image.h
// -----------------------------------------------------------------------------
//
// Image represents a color bitmap image. A simple example might look like
//
// Image im;
// im.read( "input.tga" );
// // modify image data via im(x,y) = ...;
// im.write( "output.tga" );
//
#ifndef DDG_IMAGE_H
#define DDG_IMAGE_H
#include <vector>
#include <string>
namespace DDG
{
class Image
{
public:
Image( int width = 0, int height = 0 );
// constructs image with specified width and height
float& operator()( int x, int y );
const float& operator()( int x, int y ) const;
// accesses pixel (x,y)
float sample( float x, float y ) const;
// samples image at (x,y) using bilinear filtering
int width( void ) const;
int height( void ) const;
// returns image dimensions
void read( const char* filename );
// loads an image file in Truevision TGA format
// (must be RGB image with 24 or 32 bits per pixel)
void write( const char* filename ) const;
// writes an image file in Truevision TGA format
// (RGB image with 24 bits per pixel)
protected:
void clamp( int& x, int& y ) const;
// clamps coordinates to range [0,w-1] x [0,h-1]
int w, h;
// width and height
std::vector<float> pixels;
// interleaved RGBA pixel data in range [0-1]
};
}
#endif
================================================
FILE: BaseCode/include/LinearContext.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- LinearContext.h
// -----------------------------------------------------------------------------
//
// LinearContext is the global solver context needed to interface with the
// SuiteSparse library. It is essentially a wrapper around cholmod_common. A
// single static instance of LinearContext is declared in LinearContext.cpp and
// is shared by all instances of DenseMatrix, SparseMatrix, and LinearSystem.
// In other words, you shouldn't have to instantiate LinearContext yourself
// unless you're doing something really fancy!
//
#ifndef DDG_LINEARSOLVERCONTEXT
#define DDG_LINEARSOLVERCONTEXT
#include <cholmod.h>
namespace DDG
{
class LinearContext
{
public:
LinearContext( void );
// constructor
~LinearContext( void );
// destructor
operator cholmod_common*( void );
// allows LinearContext to be treated as a cholmod_common*
protected:
cholmod_common context;
};
}
#endif
================================================
FILE: BaseCode/include/LinearEquation.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- LinearEquation.h
// -----------------------------------------------------------------------------
//
// LinearEquation represents an equation with an arbitrary linear polynomial on
// both the left- and right-hand side. It is primarily used while building a
// LinearSystem. For convenience, operator== is overloaded so that the user
// can construct a LinearEquation by writing something that looks much like the
// usual mathematical syntax for a linear equation. For example,
//
// LinearEquation eqn = ( x + 2*y == 3*z );
//
// builds the linear equation x + 2y = 3z.
//
#ifndef DDG_LINEAREQUATION_H
#define DDG_LINEAREQUATION_H
#include "LinearPolynomial.h"
namespace DDG
{
class LinearEquation
{
public:
LinearPolynomial lhs;
// left-hand side
LinearPolynomial rhs;
// right-hand side
};
LinearEquation operator==( const LinearPolynomial& lhs, const LinearPolynomial& rhs );
// constructs a linear equation with the specified left- and right-hand side
}
#endif
================================================
FILE: BaseCode/include/LinearPolynomial.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- LinearPolynomial.h
// -----------------------------------------------------------------------------
//
// LinearPolynomial represents an affine function of the form
//
// f(x1,x2,...,xn) = c1 x1 + c2 x2 + ... + cn xn + d
//
// where the xi are real-valued variables with real coefficients ci, and d is
// a real constant. The variables and their coefficients are represented using
// instances of the Variable class. LinearPolynomial implements all the usual
// algebraic operations on affine functions, as well as type conversions from
// more elementary types (scalars, single variables, etc.).
//
// Importantly, variables used in a LinearPolynomial should *not* be deallocated
// while the polynomial is still in use -- LinearPolynomial stores only a
// reference to these variables so that the solution to a linear system can be
// automatically copied back into the variables.
//
#ifndef DDG_LINEARPOLYNOMIAL_H
#define DDG_LINEARPOLYNOMIAL_H
#include <map>
#include <iosfwd>
#include "Variable.h"
namespace DDG
{
class LinearPolynomial
{
public:
LinearPolynomial( void );
// constructs the zero function
LinearPolynomial( double c );
// constructs the constant function with value c
LinearPolynomial( Variable& v );
// constructs a function with a single variable v
const LinearPolynomial& operator=( double c );
// assigns the constant function with value c
const LinearPolynomial& operator=( Variable& v );
// assigns a function with a single variable v
void operator+=( double c );
void operator-=( double c );
void operator*=( double c );
void operator/=( double c );
// adds, subtract, multiplies, or divides by a constant
void operator+=( Variable& v );
void operator-=( Variable& v );
// increments or decrements by a single variable v
void operator+=( const LinearPolynomial& p );
void operator-=( const LinearPolynomial& p );
// increments or decrements by an affine function
LinearPolynomial operator-( void ) const;
// returns the additive inverse (i.e., negation)
double evaluate( void ) const;
// evaluates the function using the current values of its variables
std::map<Variable*,double> linearTerms;
// list of linear terms
double constantTerm;
// constant term
};
LinearPolynomial operator+( double c, Variable& v ); // sum
LinearPolynomial operator+( Variable& v, double c ); // sum
LinearPolynomial operator-( double c, Variable& v ); // difference
LinearPolynomial operator-( Variable& v, double c ); // difference
LinearPolynomial operator*( double c, Variable& v ); // product
LinearPolynomial operator*( Variable& v, double c ); // product
LinearPolynomial operator/( Variable& v, double c ); // quotient
// algebraic operations between single variables and constants
LinearPolynomial operator+( Variable& v1, Variable& v2 ); // sum
LinearPolynomial operator-( Variable& v1, Variable& v2 ); // difference
// algebraic operations between pairs of variables
LinearPolynomial operator+( const LinearPolynomial& p, double c ); // sum
LinearPolynomial operator+( double c, const LinearPolynomial& p ); // sum
LinearPolynomial operator-( const LinearPolynomial& p, double c ); // difference
LinearPolynomial operator-( double c, const LinearPolynomial& p ); // difference
LinearPolynomial operator*( const LinearPolynomial& p, double c ); // product
LinearPolynomial operator*( double c, const LinearPolynomial& p ); // product
LinearPolynomial operator/( const LinearPolynomial& p, double c ); // quotient
// algebraic operations between polynomials and constants
LinearPolynomial operator+( const LinearPolynomial& p, Variable& v ); // sum
LinearPolynomial operator+( Variable& v, const LinearPolynomial& p ); // sum
LinearPolynomial operator-( const LinearPolynomial& p, Variable& v ); // difference
LinearPolynomial operator-( Variable& v, const LinearPolynomial& p ); // difference
// algebraic operations between polynomials and single variables
LinearPolynomial operator+( const LinearPolynomial& p, const LinearPolynomial& q ); // sum
LinearPolynomial operator-( const LinearPolynomial& p, const LinearPolynomial& q ); // difference
// algebraic operations between pairs of polynomials
std::ostream& operator<<( std::ostream& os, const LinearPolynomial& p );
// prints the symbolic representation of a polynomial (all variables must be named)
}
#endif
================================================
FILE: BaseCode/include/LinearSystem.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- LinearSystem.h
// -----------------------------------------------------------------------------
//
// LinearSystem represents a system of linear equations expressed in terms of
// instances of the Variable class. The main idea is to make it easy to
// construct and solve linear systems without explicitly think about variable
// indices, matrix layout, etc. (This kind of abstraction is particularly
// useful for debugging and rapid prototyping.) See the documentation for
// examples of building linear and solving systems.
//
// Importantly, any variable used by a LinearSystem should not be deallocated
// while the system is still in use, because the method LinearSystem::solve()
// automatically copies the solution back into the variables used to define the
// equations. (In the future variables may become reference-counted in order
// to avoid this issue.)
//
// Note that LinearSystem::solve() uses a general-purpose linear solver (namely
// the sparse QR factorization found in SuiteSparse) that is quite fast but may
// not always be your best option. To improve performance you may want to
// build the system explicitly using an instance of SparseMatrix and call a
// more specialized solver. (In the future there may be options for specifying
// that a LinearSystem is, e.g., symmetric and positive-definite.)
//
#ifndef DDG_LINEARSYSTEM_H
#define DDG_LINEARSYSTEM_H
#include <vector>
#include "LinearEquation.h"
#include "SparseMatrix.h"
#include "DenseMatrix.h"
#include "Real.h"
namespace DDG
{
class LinearSystem
{
public:
void clear( void );
// removes all equations from the system
void push_back( const LinearEquation& e );
// appends the equation e to the sytem
void solve( void );
// solves the system and automatically stores the result in the variables
// for an overdetermined system, computes a least-squares solution
std::vector<LinearEquation> equations;
// the collection of equations defining the system
protected:
void convertEquations( void );
void indexVariables( void );
void buildSparseMatrix( void );
void buildRightHandSide( void );
void computeSolution( void );
int nEquations;
int nVariables;
std::vector<LinearPolynomial> currentEquations;
std::map<Variable*,int> index;
SparseMatrix<Real> A;
DenseMatrix<Real> x;
DenseMatrix<Real> b;
};
}
#endif
================================================
FILE: BaseCode/include/Mesh.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Mesh.h
// -----------------------------------------------------------------------------
//
// Mesh represents a polygonal surface mesh using the halfedge data structure.
// It is essentially a large collection of disjoint vertices, edges, and faces
// that are ``glued together'' by halfedges which encode connectivity (see
// the documentation for an illustration). By construction, the halfedge data
// structure cannot represent nonorientable surfaces or meshes with nonmanifold
// edges.
//
// Mesh elements are referenced using iterators -- common usage of these
// iterators is to either traverse an entire vector of mesh elements:
//
// // visit all vertices
// for( VertexIter i = vertices.begin(); i != vertices.end(); i++ )
// {
// //...
// }
//
// or to perform a local traversal over the neighborhood of some mesh element:
//
// // visit both halfedges of edge e
// HalfEdgeIter he = e->he;
// do
// {
// // ...
//
// he = he->flip;
// }
// while( he != e->he );
//
// (See Types.h for an explicit definition of iterator types.)
//
// Meshes with boundary are handled by creating an additional face for each
// boundary loop (the method Face::isBoundary() determines whether a given
// face is a boundary loop). Isolated vertices (i.e., vertiecs not contained
// in any edge or face) reference a dummy halfedge and can be checked via
// the method Vertex::isIsolated().
//
#ifndef DDG_MESH_H
#define DDG_MESH_H
#include <vector>
#include <string>
#include "HalfEdge.h"
#include "Vertex.h"
#include "Edge.h"
#include "Face.h"
#include "SparseMatrix.h"
namespace DDG
{
class Mesh
{
public:
Mesh( void );
// constructs an empty mesh
Mesh( const Mesh& mesh );
// constructs a copy of mesh
const Mesh& operator=( const Mesh& mesh );
// copies mesh
int read( const std::string& filename );
// reads a mesh from a Wavefront OBJ file; return value is nonzero
// only if there was an error
int write( const std::string& filename ) const;
// writes a mesh to a Wavefront OBJ file; return value is nonzero
// only if there was an error
bool reload( void );
// reloads a mesh from disk using the most recent input filename
void normalize( void );
// centers around the origin and rescales to have unit radius
double area( void ) const;
// returns total mesh area
double meanEdgeLength( void ) const;
// returns mean edge lenght
std::vector<HalfEdge> halfedges;
std::vector<Vertex> vertices;
std::vector<Edge> edges;
std::vector<Face> faces;
std::vector<Face> boundaries;
// storage for mesh elements
protected:
std::string inputFilename;
void indexElements( void );
// assigns a unique, 0-based index to each mesh element
};
}
#endif
================================================
FILE: BaseCode/include/MeshIO.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- MeshIO.h
// -----------------------------------------------------------------------------
//
// MeshIO handles input/output operations for Mesh objects. Currently the only
// supported mesh format is Wavefront OBJ -- for a format specification see
//
// http://en.wikipedia.org/wiki/Wavefront_.obj_file
//
// Note that vertex normals and material properties are currently ignored.
//
#ifndef DDG_MESHIO_H
#define DDG_MESHIO_H
#include <iosfwd>
#include <string>
#include <sstream>
#include <vector>
namespace DDG
{
class Mesh;
class Index;
class MeshData;
class MeshIO
{
public:
static int read( std::istream& in, Mesh& mesh );
// reads a mesh from a valid, open input stream in
static void write( std::ostream& out, const Mesh& mesh );
// writes a mesh to a valid, open output stream out
protected:
static int readMeshData( std::istream& in, MeshData& data );
static void readPosition( std::stringstream& ss, MeshData& data );
static void readTexCoord( std::stringstream& ss, MeshData& data );
static void readNormal ( std::stringstream& ss, MeshData& data );
static void readFace ( std::stringstream& ss, MeshData& data );
static Index parseFaceIndex( const std::string& token );
static void preallocateMeshElements( const MeshData& data, Mesh& mesh );
static int buildMesh( const MeshData& data, Mesh& mesh );
static void checkIsolatedVertices( const Mesh& Mesh );
static void checkNonManifoldVertices( const Mesh& Mesh );
};
}
#endif
================================================
FILE: BaseCode/include/Quaternion.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Quaternion.h
// -----------------------------------------------------------------------------
//
// Quaternion represents an element of the quaternions, along with all the usual
// vectors space operations (addition, multiplication by scalars, etc.). The
// Hamilton product is expressed using the * operator:
//
// Quaternion p, q, r;
// r = q * p;
//
// and conjugation is expressed using the method Quaternion::conj():
//
// Quaternion q;
// double normQSquared = -q.conj()*q;
//
// Individual components can be accessed in several ways: the real and imaginary
// parts can be accessed using the methods Quaternion::re() and Quaternion::im():
//
// Quaternion q;
// double a = q.re();
// Vector b = q.im();
//
// or by index:
//
// Quaternion q;
// double a = q[0];
// double bi = q[1];
// double bj = q[2];
// double bk = q[3];
//
#ifndef DDG_QUATERNION_H
#define DDG_QUATERNION_H
#include "Vector.h"
#include "Complex.h"
#include <ostream>
namespace DDG
{
class Quaternion
{
public:
Quaternion( void );
// initializes all components to zero
Quaternion( const Quaternion& q );
// initializes from existing quaternion
Quaternion( double s, double vi, double vj, double vk );
// initializes with specified real (s) and imaginary (v) components
Quaternion( double s, const Vector& v );
// initializes with specified real (s) and imaginary (v) components
Quaternion( double s );
// initializes purely real quaternion with specified real (s) component (imaginary part is zero)
Quaternion( const Vector& v );
// initializes purely imaginary quaternion with specified imaginary (v) component (real part is zero)
Quaternion( const Complex& z );
// for a complex number z=a+bi, initializes quaternion to a+bi+0j+0k
const Quaternion& operator=( double s );
// assigns a purely real quaternion with real value s
const Quaternion& operator=( const Vector& v );
// assigns a purely real quaternion with imaginary value v
double& operator[]( int index );
// returns reference to the specified component (0-based indexing: r, i, j, k)
const double& operator[]( int index ) const;
// returns const reference to the specified component (0-based indexing: r, i, j, k)
void toMatrix( double Q[4][4] ) const;
// builds 4x4 matrix Q representing (left) quaternion multiplication
double& re( void );
// returns reference to double part
const double& re( void ) const;
// returns const reference to double part
Vector& im( void );
// returns reference to imaginary part
const Vector& im( void ) const;
// returns const reference to imaginary part
Quaternion operator+( const Quaternion& q ) const;
// addition
Quaternion operator-( const Quaternion& q ) const;
// subtraction
Quaternion operator-( void ) const;
// negation
Quaternion operator*( double c ) const;
// right scalar multiplication
Quaternion operator/( double c ) const;
// scalar division
void operator+=( const Quaternion& q );
// addition / assignment
void operator+=( double c );
// addition / assignment of pure real
void operator-=( const Quaternion& q );
// subtraction / assignment
void operator-=( double c );
// subtraction / assignment of pure real
void operator*=( double c );
// scalar multiplication / assignment
void operator/=( double c );
// scalar division / assignment
Quaternion operator*( const Quaternion& q ) const;
// Hamilton product
void operator*=( const Quaternion& q );
// Hamilton product / assignment
Quaternion conj( void ) const;
// conjugation
Quaternion inv( void ) const;
// inverse
double norm( void ) const;
// returns Euclidean length
double norm2( void ) const;
// returns Euclidean length squared
Quaternion unit( void ) const;
// returns unit quaternion
void normalize( void );
// divides by Euclidean length
protected:
double s;
// scalar (double) part
Vector v;
// vector (imaginary) part
};
Quaternion operator*( double c, const Quaternion& q );
// left scalar multiplication
std::ostream& operator<<( std::ostream& os, const Quaternion& q );
// prints components
}
#endif
================================================
FILE: BaseCode/include/Real.h
================================================
#ifndef DDG_REAL_H
#define DDG_REAL_H
namespace DDG
{
class Real
{
public:
Real( double x = 0. );
// constructs real number with value x
operator double( void ) const;
// type cast to double
void operator+=( double x );
// increment
void operator-=( double x );
// decrement
void operator*=( double x );
// multiply
void operator/=( double x );
// divide
Real conj( void ) const;
// simply returns the value (for compatibility w/ complex numbers)
Real inv( void ) const;
// returns inverse
double norm( void ) const;
// returns norm
double norm2( void ) const;
// returns norm squared
Real unit( void ) const;
// returns number with unit norm and same sign
protected:
double value;
// value
};
}
#endif
================================================
FILE: BaseCode/include/Shader.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Shader.h
// -----------------------------------------------------------------------------
//
// Shader encapsulates the functionality of a shader program written in
// the OpenGL Shader Language (GLSL). Basic usage is to read a collection
// of source files to disk and enable the shader before making draw calls.
// For instance, during initialization one might write
//
// Shader shader;
// shader.loadVertex( "vertex.glsl" );
// shader.loadFragment( "fragment.glsl" );
//
// and in the main draw routine write
//
// shader.enable();
// // draw some stuff
// shader.disable();
//
#ifndef DDG_SHADER_H
#define DDG_SHADER_H
#include <GLUT/glut.h>
#include <string>
namespace DDG
{
class Shader
{
public:
Shader( void );
// constructor -- shader is initially invalid
~Shader( void );
// destructor
void loadVertex( const char* filename );
// read vertex shader from GLSL source file
void loadFragment( const char* filename );
// read fragment shader from GLSL source file
void loadGeometry( const char* filename );
// read geometry shader from GLSL source file
void enable( void );
// uses this shader for rendering
void disable( void ) const;
// uses the fixed-function pipeline for rendering
operator GLuint( void ) const;
// returns the ID of this shader program (for calls to OpenGL)
protected:
void load( GLenum shaderType, const char* filename, GLuint& shader );
bool readSource( const char* filename, std::string& source );
GLuint vertexShader;
GLuint fragmentShader;
GLuint geometryShader;
GLuint program;
bool linked;
};
}
#endif
================================================
FILE: BaseCode/include/SparseMatrix.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- SparseMatrix.h
// -----------------------------------------------------------------------------
//
// SparseMatrix represents an m by n (real or complex) matrix where only
// nonzero entries are stored explicitly. This class is most commonly
// used to represent the linear term in sparse linear systems (i.e., the matrix
// part).
//
// A real or complex matrix is allocated via
//
// SparseMatrix A( m, n );
// SparseMatrix A( m, n, entryComplex );
//
// Matrix elements are then accessed using parenthesis, e.g.,
//
// A(i,j) = 1;
// A(i,j) += 2;
// a = A(i,j);
//
// etc.
//
// SparseMatrix is interoperable with the SuiteSparse numerical linear algebra
// library. In particular, dereferencing a SparseMatrix returns a
// cholmod_sparse* which can be used by routines in SuiteSparse. For basic
// operations, however, you should not need to access this pointer explicitly --
// see the solve() method below.
//
// Internally SparseMatrix stores nonzero entries in a heap data structure; the
// amortized cost of insertion is therefore no worse than the sorting cost of
// putting the matrix in compressed-column order.
//
#ifndef DDG_SPARSE_MATRIX_H
#define DDG_SPARSE_MATRIX_H
#include <cholmod.h>
#include <vector>
#include <map>
#include "Types.h"
namespace DDG
{
template<class T>
class SparseMatrix
{
public:
SparseMatrix( int m = 0, int n = 1 );
// initialize an mxn matrix
SparseMatrix( const SparseMatrix<T>& B );
// copy constructor
~SparseMatrix( void );
// destructor
const SparseMatrix<T>& operator=( const SparseMatrix<T>& B );
// copies B
const SparseMatrix<T>& operator=( cholmod_sparse* B );
// copies a cholmod_sparse* into a SparseMatrix;
// takes responsibility for deallocating B
void resize( int m, int n );
// clears and resizes to mxn matrix
SparseMatrix<T> transpose( void ) const;
// returns the transpose of this matrix
cholmod_sparse* to_cholmod( void );
// returns pointer to copy of matrix in compressed-column CHOLMOD format
SparseMatrix<T> operator*( const SparseMatrix<T>& B ) const;
// returns product of this matrix with sparse B
DenseMatrix<T> operator*( const DenseMatrix<T>& B ) const;
// returns product of this matrix with dense B
void operator*=( const T& c );
// multiplies this matrix by the scalar c
void operator/=( const T& c );
// divides this matrix by the scalar c
void operator+=( const SparseMatrix<T>& B );
// adds B to this matrix
void operator-=( const SparseMatrix<T>& B );
// subtracts B from this matrix
SparseMatrix<T> operator+( const SparseMatrix<T>& B ) const;
// returns sum of this matrix with B
SparseMatrix<T> operator-( const SparseMatrix<T>& B ) const;
// returns difference of this matrix with B
int nRows( void ) const;
// returns the number of rows
int nColumns( void ) const;
// returns the number of columns
int length( void ) const;
// returns the size of the largest dimension
void zero( const T& val );
// sets all nonzero elements val
SparseMatrix<T> inverse( void ) const;
// returns inverse -- for diagonal matrices only
// (assertion occurs for non-diagonal matrices)
static SparseMatrix<T> identity( int N );
// returns the N x N identity matrix
DenseMatrix<T> full( void ) const;
// converts to a dense matrix
T& operator()( int row, int col );
T operator()( int row, int col ) const;
// access the specified element (uses 0-based indexing)
// TODO for legibility, replace w/ type where entries are named "row,
// TODO col" instead of "first, second" (especially since we adopt the
// TODO unorthodox convention of storing the column first)
typedef std::pair<int,int> EntryIndex;
// convenience type for an entry index; note that we store column THEN
// row, which makes it easier to build compressed column format
typedef std::map<EntryIndex,T> EntryMap;
typedef typename EntryMap::iterator iterator;
typedef typename EntryMap::const_iterator const_iterator;
// convenience types for storing and accessing entries
iterator begin( void );
const_iterator begin( void ) const;
iterator end( void );
const_iterator end( void ) const;
// return iterators to first and last nonzero entries
void shift( double c );
// adds c times the identity matrix to this matrix
protected:
int m, n;
EntryMap data;
cholmod_sparse* cData;
void allocateSparse( void );
void setEntry( const_iterator e, int i, double* pr );
};
template <class T>
SparseMatrix<T> operator*( const SparseMatrix<T>& A, const T& c );
// right scalar multiplication
template <class T>
SparseMatrix<T> operator*( const T& c, const SparseMatrix<T>& A );
// left scalar multiplication
template <class T>
SparseMatrix<T> operator/( const SparseMatrix<T>& A, const T& c );
// scalar division
template <class T>
std::ostream& operator << (std::ostream& os, const SparseMatrix<T>& o);
// prints entries
template <class T>
class SparseFactor
{
public:
SparseFactor( void );
~SparseFactor( void );
void build( SparseMatrix<T>& A );
// factorizes positive-definite matrix A using CHOLMOD
bool valid( void ) const;
// returns true if the factor has been built; false otherwise
cholmod_factor* to_cholmod( void );
// returns pointer to underlying cholmod_factor data structure
protected:
cholmod_factor *L;
};
template <class T>
void solve( SparseMatrix<T>& A,
DenseMatrix<T>& x,
DenseMatrix<T>& b );
// solves the sparse linear system Ax = b using sparse QR factorization
template <class T>
void solveSymmetric( SparseMatrix<T>& A,
DenseMatrix<T>& x,
DenseMatrix<T>& b );
// solves the sparse linear system Ax = b using sparse LU factorization
template <class T>
void solvePositiveDefinite( SparseMatrix<T>& A,
DenseMatrix<T>& x,
DenseMatrix<T>& b );
// solves the positive definite sparse linear system Ax = b using sparse Cholesky factorization
template <class T>
void backsolvePositiveDefinite( SparseFactor<T>& L,
DenseMatrix<T>& x,
DenseMatrix<T>& b );
// backsolves the prefactored positive definite sparse linear system LL'x = b
template <class T>
void smallestEig( SparseMatrix<T>& A,
DenseMatrix<T>& x,
bool ignoreConstantVector = true );
// solves A x = lambda x for the smallest nonzero eigenvalue lambda
// A must be symmetric; x is used as an initial guess
template <class T>
void smallestEig( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& x );
// solves A x = lambda B x for the smallest nonzero generalized eigenvalue lambda
// A and B must be symmetric; x is used as an initial guess
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
DenseMatrix<T>& x,
bool ignoreConstantVector = true );
// solves A x = lambda x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite; x is used as an initial guess
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& x );
// solves A x = lambda B x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite, B must be symmetric; x is used as an initial guess
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& E,
DenseMatrix<T>& x );
// solves A x = lambda (B - EE^T) x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite, B must be symmetric; EE^T is a low-rank matrix, and
// x is used as an initial guess
template <class T>
double residual( const SparseMatrix<T>& A,
const DenseMatrix<T>& x,
const DenseMatrix<T>& b );
// returns the max residual of the linear problem A x = b relative to the largest entry of the solution
template <class T>
double residual( const SparseMatrix<T>& A,
const DenseMatrix<T>& x );
// returns the max residual of the eigenvalue problem A x = lambda x relative to the largest entry of the solution
template <class T>
double residual( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& x );
// returns the max residual of the generalized eigenvalue problem A x = lambda B x relative to the largest entry of the solution
template <class T>
double residual( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& E,
const DenseMatrix<T>& x );
// returns the max residual of the generalized eigenvalue problem A x = lambda (B - EE^T) x relative to the largest entry of the solution
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const DenseMatrix<T>& x );
// returns <Ax,x>/<x,x>
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& x );
// returns <Ax,x>/<Bx,x>
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& E,
const DenseMatrix<T>& x );
// returns <Ax,x>/<(B-EE^T)x,x>
}
#include "SparseMatrix.inl"
#endif
================================================
FILE: BaseCode/include/Types.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Types.h
// -----------------------------------------------------------------------------
//
// This file contains forward declarations of common types and definitions of
// convenience types for standard iterators.
//
#ifndef DDG_TYPES_H
#define DDG_TYPES_H
#include <cholmod.h>
#include <map>
#include <vector>
namespace DDG
{
// forward declarations
class Camera;
class Complex;
class Edge;
class Face;
class HalfEdge;
class Image;
class LinearContext;
class LinearEquation;
class LinearPolynomial;
class LinearSystem;
class Mesh;
class MeshIO;
class Quaternion;
class Real;
class Shader;
class Variable;
class Vector;
class Vertex;
class Viewer;
template <class T>
class DenseMatrix;
template <class T>
class SparseMatrix;
// convenience types for iterators
typedef std::map<Variable*,double>::iterator TermIter;
typedef std::map<Variable*,double>::const_iterator TermCIter;
typedef std::vector<LinearPolynomial>::iterator PolyIter;
typedef std::vector<LinearPolynomial>::const_iterator PolyCIter;
typedef std::vector<LinearEquation>::iterator EqnIter;
typedef std::vector<LinearEquation>::const_iterator EqnCIter;
typedef std::map<Variable*,int>::iterator IndexIter;
typedef std::map<Variable*,int>::const_iterator IndexCIter;
typedef std::vector<HalfEdge>::iterator HalfEdgeIter;
typedef std::vector<HalfEdge>::const_iterator HalfEdgeCIter;
typedef std::vector<Vertex>::iterator VertexIter;
typedef std::vector<Vertex>::const_iterator VertexCIter;
typedef std::vector<Edge>::iterator EdgeIter;
typedef std::vector<Edge>::const_iterator EdgeCIter;
typedef std::vector<Face>::iterator FaceIter;
typedef std::vector<Face>::const_iterator FaceCIter;
}
#endif
================================================
FILE: BaseCode/include/Utility.h
================================================
#ifndef DDG_UTILITY_H
#define DDG_UTILITY_H
#include <cstdlib>
#include "Utility.h"
#include "Complex.h"
namespace DDG
{
inline double sqr( double x )
{
return x*x;
}
inline double unitRand( void )
{
const double rRandMax = 1. / (double) RAND_MAX;
return rRandMax * (double) rand();
}
inline double seconds( int t0, int t1 )
{
return (double)(t1-t0) / (double) CLOCKS_PER_SEC;
}
}
namespace DDGConstants
{
static DDG::Complex ii( 0., 1. );
}
#endif
================================================
FILE: BaseCode/include/Variable.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Variable.h
// -----------------------------------------------------------------------------
//
// Variable represents a variable that can be used to define a (linear or
// nonlinear) system of equations. Its main feature is that it can be used
// both as an abstract variable (e.g., when used to define an equation) but can
// also store a definite numerical value. For instance, suppose we define a
// linear polynomial
//
// Variable x, y;
// LinearPolynomial p = x + 2*y;
//
// Now by assigning different numerical values to x and y, we can evaluate the
// polynomial at different points:
//
// *x = 1;
// *y = 2;
// cout << p.evaluate() << endl;
//
// *x = 3;
// *y = 4;
// cout << p.evaluate() << endl;
//
// In general the dereference operator (*) accesses the numerical value.
// Variables can also be named in order to aid with debugging. For instance,
//
// Variable x( "x" );
// Variable y( "y" );
// Polynomial p = x + 2*y;
// cout << p << endl;
//
// will print out something like "x+2*y".
//
// The "fixed" flag in a variable refers to whether it is held constant while
// solving a system of equations -- see the documentation for further discussion.
//
#ifndef DDG_VARIABLE_H
#define DDG_VARIABLE_H
#include <string>
namespace DDG
{
class Variable
{
public:
Variable( double value = 0., bool fixed = false );
// initialize a variable which has value zero and is not fixed by default
Variable( std::string name, double value = 0., bool fixed = false );
// initialize a named variable which has value zero and is not fixed by default
double& operator*( void );
// returns a reference to the numerical value
const double& operator*( void ) const;
// returns a const reference to the numerical value
std::string name;
// names the variable (for display output)
double value;
// numerical value
bool fixed;
// true if a variable is held constant while solving a system of equations
};
}
#endif
================================================
FILE: BaseCode/include/Vector.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Vector.h
// -----------------------------------------------------------------------------
//
// Vector represents an element of Euclidean 3-space, along with all the usual
// vectors space operations (addition, multiplication by scalars, etc.). The
// inner product (i.e., scalar or dot product) is expressed using the global
// method dot():
//
// Vector u, v;
// double cosTheta = dot( u, v );
//
// and the cross product is expressed using the global method cross():
//
// Vector u, v, w;
// w = cross( u, v );
//
// Individual components can be accessed in two ways: either directly via the
// members x, y, and z:
//
// Vector v;
// cout << v.x << endl;
// cout << v.y << endl;
// cout << v.z << endl;
//
// or by index:
//
// Vector v;
// for( int i = 0; i < 3; i++ )
// {
// cout << v[i] << endl;
// }
//
#ifndef DDG_VECTOR_H
#define DDG_VECTOR_H
#include <iostream>
namespace DDG
{
class Vector
{
public:
Vector();
// initializes all components to zero
Vector( double x, double y, double z);
// initializes with specified components
Vector( const Vector& v );
// initializes from existing vector
double& operator[] ( const int& index );
// returns reference to the specified component (0-based indexing: x, y, z)
const double& operator[] ( const int& index ) const;
// returns const reference to the specified component (0-based indexing: x, y, z)
Vector operator+( const Vector& v ) const;
// addition
Vector operator-( const Vector& v ) const;
// subtraction
Vector operator-( void ) const;
// negation
Vector operator*( const double& c ) const;
// right scalar multiplication
Vector operator/( const double& c ) const;
// scalar division
void operator+=( const Vector& v );
// addition / assignment
void operator-=( const Vector& v );
// subtraction / assignment
void operator*=( const double& c );
// scalar multiplication / assignment
void operator/=( const double& c );
// scalar division / assignment
double norm( void ) const;
// returns Euclidean length
double norm2( void ) const;
// returns Euclidean length squared
Vector unit( void ) const;
// returns unit vector
void normalize( void );
// divides by Euclidean length
Vector abs( void ) const;
// returns vector containing magnitude of each component
double x, y, z;
// components
};
Vector operator* ( const double& c, const Vector& v );
// left scalar multiplication
double dot( const Vector& u, const Vector& v );
// dot product (a.k.a. inner or scalar product)
Vector cross( const Vector& u, const Vector& v );
// cross product
std::ostream& operator << (std::ostream& os, const Vector& o);
// prints components
}
#endif
================================================
FILE: BaseCode/include/Vertex.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Vertex.h
// -----------------------------------------------------------------------------
//
// Vertex stores attributes associated with a mesh edge. The iterator he
// points to its "outgoing" halfedge. (See the documentation for a more
// in-depth discussion of the halfedge data structure.)
//
#ifndef DDG_VERTEX_H
#define DDG_VERTEX_H
#include "Vector.h"
#include "Types.h"
namespace DDG
{
class Vertex
{
public:
HalfEdgeIter he;
// points to the "outgoing" halfedge
Vector position;
// location of vertex in Euclidean 3-space
int index;
// unique integer ID in the range 0, ..., nVertices-1
bool tag;
// true if vertex is selected by the user; false otherwise
Vertex() : index(0), tag(false) { }
double area( void ) const;
// returns the barycentric area associated with this vertex
Vector normal( void ) const;
// returns the vertex normal
bool isIsolated( void ) const;
// returns true if the vertex is not contained in any face or edge; false otherwise
int valence( void ) const;
// returns the number of incident faces / edges
void toggleTag();
// toggle vertex tag
};
}
#endif
================================================
FILE: BaseCode/include/Viewer.h
================================================
// -----------------------------------------------------------------------------
// libDDG -- Viewer.h
// -----------------------------------------------------------------------------
//
// Viewer provides a graphical user interface (GUI) for inspecting and
// interacting with a Mesh object. Viewer methods are static in order
// to make them compatible with GLUT callbacks.
//
#ifndef DDG_VIEWER_H
#define DDG_VIEWER_H
#include <GLUT/glut.h>
#include "Mesh.h"
#include "Camera.h"
#include "Shader.h"
namespace DDG
{
class Viewer
{
public:
static void init( void );
// displays the viewer until the program ends
static Mesh mesh;
// surface mesh visualized by Viewer
protected:
// init
static void initGLUT( void );
static void initGLSL( void );
// GLUT callbacks
static void display( void );
static void idle( void );
static void keyboard( unsigned char c, int x, int y );
static void special( int i, int x, int y );
static void mouse( int button, int state, int x, int y );
static void motion( int x, int y );
static void menu( int value );
static void view( int value );
// menu functions
static void mProcess( void );
static void mResetMesh( void );
static void mWriteMesh( void );
static void mExit( void );
static void mWireframe( void );
static void mZoomIn( void );
static void mZoomOut( void );
static void mScreenshot( void );
// unique identifiers for menus
enum
{
menuProcess,
menuResetMesh,
menuWriteMesh,
menuExit,
menuWireframe,
menuZoomIn,
menuZoomOut,
menuScreenshot
};
// draw routines
static void setGL( void );
static void setLighting( void );
static void setMeshMaterial( void );
static void callDisplayList( void );
static void updateDisplayList( void );
static void drawScene( void );
static void drawPolygons( void );
static void drawWireframe( void );
static void drawVertices( void );
static void drawSelectedVertices( void );
static void drawIsolatedVertices( void );
static void pickVertex(int x, int y);
static void storeViewerState( void );
static void restoreViewerState( void );
static int windowSize[2];
static bool renderWireframe;
// draw wireframe
static Camera camera;
// keeps track of view state
static GLuint surfaceDL;
// display list for mesh
static Shader shader;
// shader used to determine appearance of surface
};
}
#endif
================================================
FILE: BaseCode/obj/.empty
================================================
================================================
FILE: BaseCode/shaders/fragment.glsl
================================================
uniform vec3 eye;
uniform vec3 light;
varying vec3 position;
varying vec3 normal;
float diffuse( vec3 N, vec3 L )
{
return max( 0., dot( N, L ));
}
float specular( vec3 N, vec3 L, vec3 E )
{
const float shininess = 8.;
vec3 R = 2.*dot(L,N)*N - L;
return pow( max( 0., dot( R, E )), shininess );
}
float fresnel( vec3 N, vec3 E )
{
const float sharpness = 10.;
float NE = max( 0., dot( N, E ));
return pow( sqrt( 1. - NE*NE ), sharpness );
}
void main()
{
vec3 N = normalize( normal );
vec3 L = normalize( light - position );
vec3 E = normalize( eye - position );
vec3 R = 2.*dot(L,N)*N - L;
vec3 one = vec3( 1., 1., 1. );
gl_FragColor.rgb = diffuse(N,L)*gl_Color.rgb + .5*specular(N,L,E)*one + .5*fresnel(N,E)*one;
gl_FragColor.a = 1.;
}
================================================
FILE: BaseCode/shaders/vertex.glsl
================================================
varying vec3 position;
varying vec3 normal;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = gl_Color;
position = gl_Vertex.xyz;
normal = gl_Normal.xyz;
}
================================================
FILE: BaseCode/src/Camera.cpp
================================================
#include <cmath>
#include <ctime>
#include <algorithm>
using namespace std;
#include "Camera.h"
namespace DDG
{
Camera :: Camera( void )
: pClick( 1. ),
pDrag( 1. ),
pLast( 1. ),
rLast( 1. ),
momentum( 1. ),
zoom( 1. )
{}
Quaternion Camera :: clickToSphere( int x, int y )
{
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
int w = viewport[2];
int h = viewport[3];
Quaternion p( 0.,
2. * (double) x / (double) w - 1.,
2. * (double) y / (double) h - 1.,
0. );
if( p.norm2() > 1. )
{
p.normalize();
p.im().z = 0.;
}
else
{
p.im().z = sqrt( 1. - p.norm2() );
}
return p;
}
Quaternion Camera :: currentRotation( void ) const
{
return ( pDrag * pClick.conj() ) * rLast;
}
void Camera :: setView( void ) const
{
Quaternion r = ( pDrag * pClick.conj() ) * rLast;
double w = r[0];
double x = r[1];
double y = r[2];
double z = r[3];
GLdouble M[16] = {
1.-2.*y*y-2.*z*z, 2.*x*y+2.*w*z, 2.*x*z-2.*w*y, 0.,
2.*x*y-2.*w*z, 1.-2.*x*x-2.*z*z, 2.*y*z+2.*w*x, 0.,
2.*x*z+2.*w*y, 2.*y*z-2.*w*x, 1.-2.*x*x-2.*y*y, 0.,
0., 0., 0., 1.
};
glMatrixMode( GL_MODELVIEW );
glMultMatrixd( M );
}
void Camera :: mouse( int button, int state, int x, int y )
{
if( state == GLUT_DOWN )
{
pClick = pDrag = pLast = clickToSphere( x, y );
momentum = 1.;
}
if( state == GLUT_UP )
{
double timeSinceDrag = ( clock() - tLast ) / (double) CLOCKS_PER_SEC;
if( timeSinceDrag < .1 )
{
momentum = pDrag * pLast.conj();
momentum = ( .03 * momentum + .97 ).unit();
}
else
{
momentum = 1.;
}
rLast = pDrag * pClick.conj() * rLast;
pClick = pDrag = 1.;
}
}
void Camera :: motion( int x, int y )
{
tLast = clock();
pLast = pDrag;
pDrag = clickToSphere( x, y );
}
void Camera :: idle( void )
{
// get time since last idle event
static int t0 = clock();
int t1 = clock();
double dt = (t1-t0) / (double) CLOCKS_PER_SEC;
rLast = momentum * rLast;
momentum = ( (1.-.5*dt) * momentum + .5*dt ).unit();
zoom += vZoom*dt;
vZoom *= max( 0., 1.-5.*dt );
t0 = t1;
}
void Camera :: zoomIn( void )
{
vZoom -= 0.5;
}
void Camera :: zoomOut( void )
{
vZoom += 0.5;
}
}
================================================
FILE: BaseCode/src/Complex.cpp
================================================
#include "Complex.h"
#include <iostream>
#include <cmath>
using namespace std;
namespace DDG
{
Complex::Complex( double a, double b )
// constructs number a+bi
: re( a ), im( b )
{}
void Complex::operator+=( const Complex& z )
// add z
{
re += z.re;
im += z.im;
}
void Complex::operator-=( const Complex& z )
// subtract z
{
re -= z.re;
im -= z.im;
}
void Complex::operator*=( const Complex& z )
// Complex multiply by z
{
double a = re;
double b = im;
double c = z.re;
double d = z.im;
re = a*c-b*d;
im = a*d+b*c;
}
void Complex::operator*=( double r )
// scalar multiply by r
{
re *= r;
im *= r;
}
void Complex::operator/=( double r )
// scalar divide by r
{
re /= r;
im /= r;
}
void Complex::operator/=( const Complex& z )
// scalar divide by r
{
*this *= z.inv();
}
Complex Complex::operator-( void ) const
{
return Complex( -re, -im );
}
Complex Complex::conj( void ) const
// returns Complex conjugate
{
return Complex( re, -im );
}
Complex Complex::inv( void ) const
// returns inverse
{
return this->conj() / this->norm2();
}
double Complex::arg( void ) const
// returns argument
{
return atan2( im, re );
}
double Complex::norm( void ) const
// returns norm
{
return sqrt( re*re + im*im );
}
double Complex::norm2( void ) const
// returns norm squared
{
return re*re + im*im;
}
Complex Complex::unit( void ) const
// returns complex number with unit norm and same modulus
{
return *this / this->norm();
}
Complex Complex::exponential( void ) const
// complex exponentiation
{
return exp( re ) * Complex( cos( im ), sin( im ));
}
Complex operator+( const Complex& z1, const Complex& z2 )
// binary addition
{
Complex z = z1;
z += z2;
return z;
}
Complex operator-( const Complex& z1, const Complex& z2 )
// binary subtraction
{
Complex z = z1;
z -= z2;
return z;
}
Complex operator*( const Complex& z1, const Complex& z2 )
// binary Complex multiplication
{
Complex z = z1;
z *= z2;
return z;
}
Complex operator*( const Complex& z, double r )
// right scalar multiplication
{
Complex zr = z;
zr *= r;
return zr;
}
Complex operator*( double r, const Complex& z )
// left scalar multiplication
{
return z*r;
}
Complex operator/( const Complex& z, double r )
// scalar division
{
Complex zr = z;
zr /= r;
return zr;
}
Complex operator/( const Complex& z1, const Complex& z2 )
// complex division
{
Complex z = z1;
z /= z2;
return z;
}
double dot( const Complex& z1, const Complex& z2 )
{
return z1.re*z2.re + z1.im*z2.im;
}
double cross( const Complex& z1, const Complex& z2 )
{
return z1.re*z2.im - z1.im*z2.re;
}
std::ostream& operator<<( std::ostream& os, const Complex& z )
// prints components
{
if( z.im > 0 )
{
os << z.re << " + " << z.im << "i";
}
else if( z.im < 0 )
{
os << z.re << " - " << -z.im << "i";
}
else
{
os << z.re;
}
return os;
}
}
================================================
FILE: BaseCode/src/DenseMatrix.cpp
================================================
#include "DenseMatrix.h"
namespace DDG
{
template <>
cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
// returns pointer to underlying cholmod_dense data structure
{
if( cData )
{
cholmod_l_free_dense( &cData, context );
cData = NULL;
}
int d = m; // leading dimension
cData = cholmod_l_allocate_dense( m, n, d, CHOLMOD_REAL, context );
double* x = (double*) cData->x;
for( int i = 0; i < m*n; i++ )
{
x[i] = data[i];
}
return cData;
}
template <>
cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
// returns pointer to underlying cholmod_dense data structure
{
if( cData )
{
cholmod_l_free_dense( &cData, context );
cData = NULL;
}
int d = m; // leading dimension
cData = cholmod_l_allocate_dense( m, n, d, CHOLMOD_COMPLEX, context );
double* x = (double*) cData->x;
for( int i = 0; i < m*n; i++ )
{
x[i*2+0] = data[i].re;
x[i*2+1] = data[i].im;
}
return cData;
}
template <>
cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
// returns pointer to underlying cholmod_dense data structure
{
assert( nColumns() == 1 );
if( cData )
{
cholmod_l_free_dense( &cData, context );
cData = NULL;
}
cData = cholmod_l_allocate_dense( m*4, 1, m*4, CHOLMOD_REAL, context );
double* x = (double*) cData->x;
for( int i = 0; i < m*n; i++ )
{
for( int k = 0; k < 4; k++ )
{
x[i*4+k] = data[i][k];
}
}
return cData;
}
template <>
const DenseMatrix<Real>& DenseMatrix<Real> :: operator=( cholmod_dense* B )
// copies a cholmod_dense* into a DenseMatrix;
// takes responsibility for deallocating B
{
assert( B );
assert( B->xtype == CHOLMOD_REAL );
if( cData )
{
cholmod_l_free_dense( &cData, context );
}
cData = B;
m = cData->nrow;
n = cData->ncol;
data.resize( m*n );
double* x = (double*) cData->x;
for( int i = 0; i < m*n; i++ )
{
data[i] = x[i];
}
return *this;
}
template <>
const DenseMatrix<Complex>& DenseMatrix<Complex> :: operator=( cholmod_dense* B )
// copies a cholmod_dense* into a DenseMatrix;
// takes responsibility for deallocating B
{
assert( B );
assert( B->xtype == CHOLMOD_COMPLEX );
if( cData )
{
cholmod_l_free_dense( &cData, context );
}
cData = B;
m = cData->nrow;
n = cData->ncol;
data.resize( m*n );
double* x = (double*) cData->x;
for( int i = 0; i < m*n; i++ )
{
data[i] = Complex( x[i*2+0],
x[i*2+1] );
}
return *this;
}
template <>
const DenseMatrix<Quaternion>& DenseMatrix<Quaternion> :: operator=( cholmod_dense* B )
// copies a cholmod_dense* into a DenseMatrix;
// takes responsibility for deallocating B
{
assert( B );
assert( B->xtype == CHOLMOD_REAL );
assert( B->ncol == 1 );
assert( B->nrow%4 == 0 );
if( cData )
{
cholmod_l_free_dense( &cData, context );
}
cData = B;
m = cData->nrow/4;
n = 1;
data.resize( m*n );
double* x = (double*) cData->x;
for( int i = 0; i < m; i++ )
{
data[i] = Quaternion( x[i*4+0],
x[i*4+1],
x[i*4+2],
x[i*4+3] );
}
return *this;
}
template <>
std::ostream& operator<< (std::ostream& os, const DenseMatrix<Real>& o)
{
const int p = 3;
os.precision( p );
os << scientific;
for( int i = 0; i < o.nRows(); i++ )
{
os << "[ ";
for( int j = 0; j < o.nColumns(); j++ )
{
double x = o(i,j);
if( x == 0. )
{
os << " 0";
for( int k = 0; k < p+6; k++ )
{
os << " ";
}
}
else if( x > 0. )
{
os << " " << x << " ";
}
else
{
os << x << " ";
}
}
os << "]" << endl;
}
return os;
}
template <>
std::ostream& operator<< (std::ostream& os, const DenseMatrix<Complex>& o)
{
const int p = 2;
os.precision( p );
os << scientific;
for( int i = 0; i < o.nRows(); i++ )
{
os << "[ ";
for( int j = 0; j < o.nColumns(); j++ )
{
Complex z = o(i,j);
if( z.re == 0. )
{
os << " 0";
for( int k = 0; k < p+5; k++ )
{
os << " ";
}
}
else if( z.re > 0. )
{
os << " " << z.re;
}
else
{
os << z.re;
}
if( z.im == 0 )
{
os << " ";
}
else if( z.im >= 0 )
{
os << "+";
}
else
{
os << "-";
}
if( z.im == 0. )
{
for( int k = 0; k < p+8; k++ )
{
os << " ";
}
}
else
{
os << abs( z.im ) << "i ";
}
}
os << " ]" << endl;
}
return os;
}
template <>
std::ostream& operator<< (std::ostream& os, const DenseMatrix<Quaternion>& o)
{
const int p = 2;
os.precision( p );
os << scientific;
for( int i = 0; i < o.nRows(); i++ )
{
os << "[";
for( int j = 0; j < o.nColumns(); j++ )
{
Quaternion q = o(i,j);
os << " " << q;
}
os << " ]" << endl;
}
return os;
}
template <>
void DenseMatrix<Real> :: randomize( void )
// replaces entries with uniformly distributed real random numbers in the interval [-1,1]
{
for( int i = 0; i < m*n; i++ )
{
data[i] = 2.*unitRand() - 1.;
}
}
template <>
void DenseMatrix<Complex> :: randomize( void )
// replaces entries with uniformly distributed real random numbers in the interval [-1,1]
{
for( int i = 0; i < m*n; i++ )
{
data[i].re = 2.*unitRand() - 1.;
data[i].im = 2.*unitRand() - 1.;
}
}
template <>
void DenseMatrix<Quaternion> :: randomize( void )
// replaces entries with uniformly distributed real random numbers in the interval [-1,1]
{
for( int i = 0; i < m*n; i++ )
{
for( int k = 0; k < 4; k++ )
{
data[i][k] = 2.*unitRand() - 1.;
}
}
}
}
================================================
FILE: BaseCode/src/DenseMatrix.inl
================================================
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
#include "DenseMatrix.h"
#include "LinearContext.h"
#include "Quaternion.h"
#include "SparseMatrix.h"
#include "Utility.h"
namespace DDG
{
extern LinearContext context;
template <class T>
DenseMatrix<T> :: DenseMatrix( int m_, int n_ )
// initialize an mxn matrix
: m( m_ ),
n( n_ ),
cData( NULL )
{
data.resize( m*n );
zero();
}
template <class T>
DenseMatrix<T> :: DenseMatrix( const DenseMatrix<T>& A )
// copy constructor
: cData( NULL )
{
*this = A;
}
template <class T>
DenseMatrix<T> :: ~DenseMatrix( void )
// destructor
{
if( cData != NULL )
{
cholmod_l_free_dense( &cData, context );
}
}
template <class T>
DenseMatrix<T> DenseMatrix<T> :: transpose( void ) const
{
const DenseMatrix<T>& A( *this );
DenseMatrix<T> AT( n, m );
for( int i = 0; i < n; i++ )
for( int j = 0; j < m; j++ )
{
AT(i,j) = A(j,i).conj();
}
return AT;
}
template <class T>
SparseMatrix<T> DenseMatrix<T>::sparse( void )
// converts to a sparse matrix
{
SparseMatrix<T> B;
B = cholmod_l_dense_to_sparse( this->to_cholmod(), true, context );
return B;
}
template <class T>
DenseMatrix<T> DenseMatrix<T> :: operator*( const DenseMatrix<T>& B ) const
// returns product of this matrix with B
{
const DenseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nColumns() == B.nRows() );
DenseMatrix<T> AB( A.nRows(), B.nColumns() );
for( int i = 0; i < A.nRows(); i++ )
for( int j = 0; j < B.nColumns(); j++ )
for( int k = 0; k < A.nColumns(); k++ )
{
AB( i, j ) += A( i, k ) * B( k, j );
}
return AB;
}
template <class T>
void DenseMatrix<T> :: operator*=( const T& c )
{
DenseMatrix<T>& A( *this );
for( int i = 0; i < m; i++ )
for( int j = 0; j < n; j++ )
{
A(i,j) *= c;
}
}
template <class T>
void DenseMatrix<T> :: operator/=( const T& c )
{
DenseMatrix<T>& A( *this );
for( int i = 0; i < m; i++ )
for( int j = 0; j < n; j++ )
{
A(i,j) *= c.inv();
}
}
template <class T>
DenseMatrix<T> DenseMatrix<T> :: operator+( const DenseMatrix<T>& B ) const
// returns sum of this matrix with B
{
const DenseMatrix& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
DenseMatrix<T> C( nRows(), nColumns() );
for( int i = 0; i < nRows(); i++ )
for( int j = 0; j < nColumns(); j++ )
{
C(i,j) = A(i,j) + B(i,j);
}
return C;
}
template <class T>
void DenseMatrix<T> :: operator+=( const DenseMatrix<T>& B )
{
DenseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
for( int i = 0; i < nRows(); i++ )
for( int j = 0; j < nColumns(); j++ )
{
A(i,j) += B(i,j);
}
}
template <class T>
DenseMatrix<T> DenseMatrix<T> :: operator-( const DenseMatrix<T>& B ) const
// returns difference of this matrix with B
{
const DenseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
DenseMatrix C( nRows(), nColumns() );
for( int i = 0; i < nRows(); i++ )
for( int j = 0; j < nColumns(); j++ )
{
C(i,j) = A(i,j) - B(i,j);
}
return C;
}
template <class T>
void DenseMatrix<T> :: operator-=( const DenseMatrix<T>& B )
{
DenseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
for( int i = 0; i < nRows(); i++ )
for( int j = 0; j < nColumns(); j++ )
{
A(i,j) -= B(i,j);
}
}
template <class T>
DenseMatrix<T> operator*( const T& c, const DenseMatrix<T>& A )
{
DenseMatrix<T> cA = A;
cA *= c;
return cA;
}
template <class T>
DenseMatrix<T> operator*( const DenseMatrix<T>& A, double c )
{
return c*A;
}
template <class T>
DenseMatrix<T> operator/( const DenseMatrix<T>& A, double c )
{
DenseMatrix<T> Ac = A;
Ac /= c;
return Ac;
}
template <class T>
const DenseMatrix<T>& DenseMatrix<T> :: operator=( const DenseMatrix<T>& B )
// copies B
{
if( cData )
{
cholmod_l_free_dense( &cData, context );
cData = NULL;
}
m = B.m;
n = B.n;
data = B.data;
return *this;
}
template <class T>
int DenseMatrix<T> :: nRows( void ) const
// returns the number of rows
{
return m;
}
template <class T>
int DenseMatrix<T> :: nColumns( void ) const
// returns the number of columns
{
return n;
}
template <class T>
int DenseMatrix<T> :: length( void ) const
// returns the size of the largest dimension
{
return max( m, n );
}
template <class T>
void DenseMatrix<T> :: zero( const T& val )
// sets all elements to val
{
for( int i = 0; i < m*n; i++ )
{
data[i] = val;
}
}
template <class T>
double DenseMatrix<T> :: norm( NormType type ) const
{
double r = 0.;
if( type == lInfinity )
{
for( int i = 0; i < m*n; i++ )
{
r = max( r, data[i].norm() );
}
}
else if( type == lOne )
{
for( int i = 0; i < m*n; i++ )
{
r += data[i].norm();
}
}
else if( type == lTwo )
{
for( int i = 0; i < m*n; i++ )
{
r += data[i].norm2();
}
r = sqrt( r );
}
return r;
}
template <class T>
void DenseMatrix<T> :: normalize( void )
// divides by l2 norm
{
*this /= norm( lTwo );
}
template <class T>
T& DenseMatrix<T> :: operator()( int row, int col )
{
return data[row+m*col];
}
template <class T>
T DenseMatrix<T> :: operator()( int row, int col ) const
{
return data[row+m*col];
}
template <class T>
T& DenseMatrix<T> :: operator()( int index )
{
return data[index];
}
template <class T>
T DenseMatrix<T> :: operator()( int index ) const
{
return data[index];
}
template <class T>
T DenseMatrix<T>::sum( void ) const
// returns the sum of all entries
{
T total( 0., 0. );
for( int i = 0; i < m*n; i++ )
{
total += data[i];
}
return total;
}
template <class T>
void DenseMatrix<T> :: removeMean( void )
{
T mean = 0.;
int N = m*n;
for( int i = 0; i < N; i++ )
{
mean += data[i];
}
mean /= (double) N;
for( int i = 0; i < N; i++ )
{
data[i] -= mean;
}
}
template <class T>
T dot( const DenseMatrix<T>& x, const DenseMatrix<T>& y )
// returns Euclidean inner product of x and y
{
return ( x.transpose() * y )(0);
}
template <class T>
DenseMatrix<T> DenseMatrix<T>::operator-( void ) const
// returns additive inverse of this matrix
{
const DenseMatrix<T>& A( *this );
DenseMatrix<T> B( m, n );
for( int i = 0; i < m; i++ )
for( int j = 0; j < n; j++ )
{
B( i, j ) = -A( i, j );
}
return B;
}
template <class T>
T inner( const DenseMatrix<T>& x,
const DenseMatrix<T>& y )
// standard inner product
{
T sum = 0.;
assert( x.nRows() == y.nRows() &&
x.nColumns() == y.nColumns() );
for( int i = 0; i < x.nRows()*x.nColumns(); i++ )
{
sum += x(i).conj() * y(i);
}
return sum;
}
template <class T>
T inner( const DenseMatrix<T>& x,
const DenseMatrix<T>& B,
const DenseMatrix<T>& y )
// inner product with respect a diagonal inner
// product B represented as a dense vector
{
T sum = 0.;
assert( x.nRows() == y.nRows() &&
x.nRows() == B.nRows() &&
x.nColumns() == 1 &&
B.nColumns() == 1 &&
y.nColumns() == 1 );
for( int i = 0; i < x.nRows()*x.nColumns(); i++ )
{
sum += x(i).conj() * B(i) * y(i);
}
return sum;
}
}
================================================
FILE: BaseCode/src/DiscreteExteriorCalculus.inl
================================================
#include "DiscreteExteriorCalculus.h"
namespace DDG
{
template <class T>
void HodgeStar0Form<T> :: build( const Mesh& mesh,
SparseMatrix<T>& star0 )
// builds a diagonal matrix mapping primal discrete 0-forms
// to dual discrete 2-forms
{
int nV = mesh.vertices.size();
star0 = SparseMatrix<T>( nV, nV );
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
int i = v->index;
star0( i, i ) = v->area();
}
}
template <class T>
void HodgeStar1Form<T> :: build( const Mesh& mesh,
SparseMatrix<T>& star1 )
// builds a diagonal matrix mapping primal discrete 1-forms
// to dual discrete 1-forms
{
int nE = mesh.edges.size();
star1 = SparseMatrix<T>( nE, nE );
for( EdgeCIter e = mesh.edges.begin();
e != mesh.edges.end();
e ++ )
{
// get the cotangents of the two angles opposite this edge
double cotAlpha = e->he->cotan();
double cotBeta = e->he->flip->cotan();
int i = e->index;
star1( i, i ) = ( cotAlpha + cotBeta ) / 2.;
}
}
template <class T>
void HodgeStar2Form<T> :: build( const Mesh& mesh,
SparseMatrix<T>& star2 )
// builds a diagonal matrix mapping primal discrete 2-forms
// to dual discrete 2-forms
{
int nF = mesh.faces.size();
star2 = SparseMatrix<T>( nF, nF );
for( FaceCIter f = mesh.faces.begin();
f != mesh.faces.end();
f ++ )
{
int i = f->index;
star2( i, i ) = 1. / f->area();
}
}
template< class T >
void ExteriorDerivative0Form<T> :: build( const Mesh& mesh,
SparseMatrix<T>& d0 )
{
int nV = mesh.vertices.size();
int nE = mesh.edges.size();
d0 = SparseMatrix<T>( nE, nV );
for( EdgeCIter e = mesh.edges.begin();
e != mesh.edges.end();
e ++ )
{
// the row index is the index of the edge
int r = e->index;
// the column indices are the indices of the two
// edge vertices -- orientation is determined by
// the orientation of the edge's first half edge
int ci = e->he->vertex->index;
int cj = e->he->flip->vertex->index;
d0( r, ci ) = -1.;
d0( r, cj ) = 1.;
}
}
template< class T >
void ExteriorDerivative1Form<T> :: build( const Mesh& mesh,
SparseMatrix<T>& d1 )
{
int nE = mesh.edges.size();
int nF = mesh.faces.size();
d1 = SparseMatrix<T>( nF, nE );
// visit each face
for( FaceCIter f = mesh.faces.begin();
f != mesh.faces.end();
f ++ )
{
// the row index is the index of the face
int r = f->index;
// visit all edges of this face
HalfEdgeCIter he = f->he;
do
{
// the column index is the index of the current edge
int c = he->edge->index;
// relative orientation is determined by checking if
// the current half edge is the first half edge of its
// corresponding edge
double s = ( he->edge->he == he ? 1. : -1. );
// set the entry for this edge
d1( r, c ) = s;
he = he->next;
}
while( he != f->he );
}
}
}
================================================
FILE: BaseCode/src/Edge.cpp
================================================
#include "Edge.h"
#include "Mesh.h"
namespace DDG
{
}
================================================
FILE: BaseCode/src/Face.cpp
================================================
#include "Face.h"
#include "Mesh.h"
#include "Vector.h"
namespace DDG
{
double Face::area( void ) const
{
Vector p0 = he->vertex->position;
Vector p1 = he->next->vertex->position;
Vector p2 = he->next->next->vertex->position;
return cross( p1-p0, p2-p0 ).norm() / 2.;
}
Vector Face::normal( void ) const
{
Vector p0 = he->vertex->position;
Vector p1 = he->next->vertex->position;
Vector p2 = he->next->next->vertex->position;
return cross( p1-p0, p2-p0 ).unit();
}
bool Face::isBoundary( void ) const
{
return he->onBoundary;
}
Vector Face :: circumcenter( void ) const
{
Vector p0 = he->vertex->position;
Vector p1 = he->next->vertex->position;
Vector n = he->rotatedEdge();
double h = 0.5*he->cotan();
return 0.5*(p0+p1) + h*n;
}
Vector Face :: barycenter( void ) const
{
Vector p0 = he->vertex->position;
Vector p1 = he->next->vertex->position;
Vector p2 = he->next->next->vertex->position;
return (p0 + p1 + p2)/3.;
}
}
================================================
FILE: BaseCode/src/HalfEdge.cpp
================================================
#include "HalfEdge.h"
#include "Mesh.h"
namespace DDG
{
double HalfEdge :: cotan( void ) const
{
if( onBoundary ) return 0.0;
Vector p0 = next->next->vertex->position;
Vector p1 = vertex->position;
Vector p2 = next->vertex->position;
Vector u = p1-p0;
Vector v = p2-p0;
return dot( u, v ) / cross( u, v ).norm();
}
Vector HalfEdge :: rotatedEdge( void ) const
{
if( onBoundary ) return Vector();
Vector n = face->normal();
Vector p0 = vertex->position;
Vector p1 = flip->vertex->position;
return cross( n, p1-p0 );
}
}
================================================
FILE: BaseCode/src/Image.cpp
================================================
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iostream>
using namespace std;
#include "Image.h"
namespace DDG
{
Image :: Image( int width, int height )
: w( width ), h( height ), pixels( w*h*3 )
{}
float& Image :: operator()( int x, int y )
// accesses pixel (x,y)
{
return pixels[ x + y*w ];
}
const float& Image :: operator()( int x, int y ) const
// accesses pixel (x,y)
{
return pixels[ x + y*w ];
}
float Image :: sample( float x, float y ) const
// samples image at (x,y) using bilinear filtering
{
const Image& I( *this );
float ax = x - floor( x );
float ay = y - floor( y );
float bx = 1. - ax;
float by = 1. - ay;
int x0 = (int) floor( x );
int y0 = (int) floor( y );
int x1 = x0 + 1;
int y1 = y0 + 1;
clamp( x0, y0 );
clamp( x1, y1 );
return by * ( bx * I(x0,y0) + ax * I(x1,y0) ) +
ay * ( bx * I(x0,y1) + ax * I(x1,y1) ) ;
}
int Image :: width( void ) const
// returns image width
{
return w;
}
int Image :: height( void ) const
// returns image height
{
return h;
}
class TGAHeader
// header format for Truevision TGA images
{
public:
char idFieldSize;
char colorMapType;
char dataTypeCode;
short colorMapOrigin;
short colorMapLength;
char colorMapEntrySize;
short xOrigin;
short yOrigin;
short width;
short height;
char bitsPerPixel;
char imageSpecification;
};
void Image :: read( const char* filename )
// loads an image file in Truevision TGA format
// (must be uncompressed RGB image with 24 or 32 bits per pixel)
{
ifstream in( filename, ios_base::binary );
if( !in.is_open() )
{
cerr << "Error: could not open file " << filename << " for input!" << endl;
exit( 1 );
}
// read header
TGAHeader header;
in.read( (char*) &(header.idFieldSize), 1 );
in.read( (char*) &(header.colorMapType), 1 );
in.read( (char*) &(header.dataTypeCode), 1 );
in.read( (char*) &(header.colorMapOrigin), 2 );
in.read( (char*) &(header.colorMapLength), 2 );
in.read( (char*) &(header.colorMapEntrySize), 1 );
in.read( (char*) &(header.xOrigin), 2 );
in.read( (char*) &(header.yOrigin), 2 );
in.read( (char*) &(header.width), 2 );
in.read( (char*) &(header.height), 2 );
in.read( (char*) &(header.bitsPerPixel), 1 );
in.read( (char*) &(header.imageSpecification), 1 );
w = header.width;
h = header.height;
// validate data type
const char uncompressedRGB = 2;
if( header.dataTypeCode != uncompressedRGB ||
( header.bitsPerPixel != 24 &&
header.bitsPerPixel != 32 ))
{
cerr << "Error: input must be uncompressed RGB image with 24 or 32 bits per pixel." << endl;
exit( 1 );
}
// read identification field (unused)
vector<char> idField( header.idFieldSize );
in.read( &idField[0], header.idFieldSize );
// read color map data (unused)
if( header.colorMapType == 1 )
{
int bytesPerEntry = header.colorMapEntrySize / 8;
int colorMapSize = header.colorMapLength * bytesPerEntry;
vector<char> colorMapData( colorMapSize );
in.read( &colorMapData[0], colorMapSize );
}
// read pixel data
int n = w*h*header.bitsPerPixel/8;
vector<unsigned char> pixelData( n );
in.read( (char*) &pixelData[0], n );
// convert pixel data to floating point
pixels.resize( n );
for( int i = 0; i < n; i++ )
{
pixels[i] = (double) pixelData[i] / 255.;
}
}
void Image :: write( const char* filename ) const
// writes an image file in Truevision TGA format
// (uncompressed RGB image with 24 bits per pixel)
{
ofstream out( filename, ios_base::binary );
if( !out.is_open() )
{
cerr << "Error: could not open file " << filename << " for output!" << endl;
exit( 1 );
}
TGAHeader header;
header.idFieldSize = 0;
header.colorMapType = 0;
header.dataTypeCode = 2;
header.colorMapOrigin = 0;
header.colorMapLength = 0;
header.colorMapEntrySize = 0;
header.xOrigin = 0;
header.yOrigin = 0;
header.width = w;
header.height = h;
header.bitsPerPixel = 24;
header.imageSpecification = 0;
// write header
out.write( (char*) &(header.idFieldSize), 1 );
out.write( (char*) &(header.colorMapType), 1 );
out.write( (char*) &(header.dataTypeCode), 1 );
out.write( (char*) &(header.colorMapOrigin), 2 );
out.write( (char*) &(header.colorMapLength), 2 );
out.write( (char*) &(header.colorMapEntrySize), 1 );
out.write( (char*) &(header.xOrigin), 2 );
out.write( (char*) &(header.yOrigin), 2 );
out.write( (char*) &(header.width), 2 );
out.write( (char*) &(header.height), 2 );
out.write( (char*) &(header.bitsPerPixel), 1 );
out.write( (char*) &(header.imageSpecification), 1 );
// convert pixel data from floating point
vector<unsigned char> pixelData( w*h*3 );
for( int i = 0; i < w*h*3; i++ )
{
pixelData[i] = (unsigned char)( pixels[i] * 255. );
}
// write pixel data
out.write( (char*) &pixelData[0], w*h*3 );
}
void Image :: clamp( int& x, int& y ) const
// clamps coordinates to range [0,w-1] x [0,h-1]
{
x = max( 0, min( w-1, x ));
y = max( 0, min( h-1, y ));
}
}
================================================
FILE: BaseCode/src/LinearContext.cpp
================================================
#include "LinearContext.h"
namespace DDG
{
// global context for linear solvers
LinearContext context;
LinearContext :: LinearContext( void )
// constructor
{
cholmod_l_start( &context );
}
LinearContext :: ~LinearContext( void )
// destructor
{
cholmod_l_finish( &context );
}
LinearContext :: operator cholmod_common*( void )
// allows LinearContext to be treated as a cholmod_common*
{
return &context;
}
}
================================================
FILE: BaseCode/src/LinearEquation.cpp
================================================
#include "LinearEquation.h"
namespace DDG
{
LinearEquation operator==( const LinearPolynomial& lhs,
const LinearPolynomial& rhs )
// constructs a linear equation with the specified left- and right-hand side
{
LinearEquation eqn;
eqn.lhs = lhs;
eqn.rhs = rhs;
return eqn;
}
}
================================================
FILE: BaseCode/src/LinearPolynomial.cpp
================================================
#include <iostream>
using namespace std;
#include "LinearPolynomial.h"
#include "Types.h"
namespace DDG
{
LinearPolynomial :: LinearPolynomial( void )
: constantTerm( 0. )
{}
LinearPolynomial :: LinearPolynomial( double c )
{
*this = c;
}
LinearPolynomial :: LinearPolynomial( Variable& v )
{
*this = v;
}
const LinearPolynomial& LinearPolynomial :: operator=( double c )
{
linearTerms.clear();
constantTerm = c;
return *this;
}
const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
{
linearTerms.clear();
linearTerms[ &v ] = 1.;
constantTerm = 0.;
return *this;
}
void LinearPolynomial::operator+=( double c )
{
constantTerm += c;
}
void LinearPolynomial::operator-=( double c )
{
constantTerm -= c;
}
void LinearPolynomial::operator*=( double c )
{
for( TermIter i = linearTerms.begin();
i != linearTerms.end();
i ++ )
{
i->second *= c;
}
constantTerm *= c;
}
void LinearPolynomial::operator/=( double c )
{
for( TermIter i = linearTerms.begin();
i != linearTerms.end();
i ++ )
{
i->second /= c;
}
constantTerm /= c;
}
void LinearPolynomial::operator+=( Variable& v )
{
LinearPolynomial p( v );
*this += p;
}
void LinearPolynomial::operator-=( Variable& v )
{
LinearPolynomial p( v );
*this -= p;
}
void LinearPolynomial::operator+=( const LinearPolynomial& e )
{
for( TermCIter i = e.linearTerms.begin();
i != e.linearTerms.end();
i++ )
{
TermIter j = linearTerms.find( i->first );
if( j != linearTerms.end() )
{
j->second += i->second;
}
else
{
linearTerms[i->first] = i->second;
}
}
constantTerm += e.constantTerm;
}
void LinearPolynomial::operator-=( const LinearPolynomial& e )
{
for( TermCIter i = e.linearTerms.begin();
i != e.linearTerms.end();
i++ )
{
TermIter j = linearTerms.find( i->first );
if( j != linearTerms.end() )
{
j->second -= i->second;
}
else
{
linearTerms[i->first] = -i->second;
}
}
constantTerm -= e.constantTerm;
}
LinearPolynomial LinearPolynomial::operator-( void ) const
{
LinearPolynomial p = *this;
for( TermIter i = p.linearTerms.begin();
i != p.linearTerms.end();
i ++ )
{
i->second = -i->second;
}
p.constantTerm = -p.constantTerm;
return p;
}
double LinearPolynomial::evaluate( void ) const
{
double value = constantTerm;
for( TermCIter i = linearTerms.begin();
i != linearTerms.end();
i ++ )
{
value += i->second * i->first->value;
}
return value;
}
LinearPolynomial operator+( double c,
Variable& v )
{
return c + LinearPolynomial(v);
}
LinearPolynomial operator+( Variable& v,
double c )
{
return LinearPolynomial(v) + c;
}
LinearPolynomial operator-( double c,
Variable& v )
{
return c - LinearPolynomial(v);
}
LinearPolynomial operator-( Variable& v,
double c )
{
return LinearPolynomial(v) - c;
}
LinearPolynomial operator*( double c,
Variable& v )
{
return LinearPolynomial(v) * c;
}
LinearPolynomial operator*( Variable& v,
double c )
{
return LinearPolynomial(v) * c;
}
LinearPolynomial operator/( Variable& v,
double c )
{
return LinearPolynomial(v) / c;
}
LinearPolynomial operator+( Variable& v1,
Variable& v2 )
{
return LinearPolynomial(v1) + LinearPolynomial(v2);
}
LinearPolynomial operator-( Variable& v1,
Variable& v2 )
{
return LinearPolynomial(v1) - LinearPolynomial(v2);
}
LinearPolynomial operator+( const LinearPolynomial& p,
double c )
{
LinearPolynomial sum = p;
sum += c;
return sum;
}
LinearPolynomial operator+( double c,
const LinearPolynomial& p )
{
LinearPolynomial sum = p;
sum += c;
return sum;
}
LinearPolynomial operator-( const LinearPolynomial& p,
double c )
{
LinearPolynomial difference = p;
difference -= c;
return difference;
}
LinearPolynomial operator-( double c,
const LinearPolynomial& p )
{
LinearPolynomial difference = -p;
difference += c;
return difference;
}
LinearPolynomial operator*( const LinearPolynomial& p,
double c )
{
LinearPolynomial product = p;
product *= c;
return product;
}
LinearPolynomial operator*( double c,
const LinearPolynomial& p )
{
LinearPolynomial product = p;
product *= c;
return product;
}
LinearPolynomial operator/( const LinearPolynomial& p,
double c )
{
LinearPolynomial quotient = p;
quotient /= c;
return quotient;
}
LinearPolynomial operator+( const LinearPolynomial& p,
Variable& v )
{
return p + LinearPolynomial(v);
}
LinearPolynomial operator+( Variable& v,
const LinearPolynomial& p )
{
return LinearPolynomial(v) + p;
}
LinearPolynomial operator-( const LinearPolynomial& p,
Variable& v )
{
return p - LinearPolynomial(v);
}
LinearPolynomial operator-( Variable& v,
const LinearPolynomial& p )
{
return LinearPolynomial(v) - p;
}
LinearPolynomial operator+( const LinearPolynomial& p,
const LinearPolynomial& q )
{
LinearPolynomial sum = p;
sum += q;
return sum;
}
LinearPolynomial operator-( const LinearPolynomial& p,
const LinearPolynomial& q )
{
LinearPolynomial difference = p;
difference -= q;
return difference;
}
ostream& operator<<( ostream& os, const LinearPolynomial& p )
{
for( TermCIter i = p.linearTerms.begin();
i != p.linearTerms.end();
i ++ )
{
os << i->second << "*" << i->first->name << " + ";
}
os << p.constantTerm;
return os;
}
}
================================================
FILE: BaseCode/src/LinearSystem.cpp
================================================
#include <map>
using namespace std;
#include <SuiteSparseQR.hpp>
#include "LinearSystem.h"
#include "LinearContext.h"
#include "Types.h"
namespace DDG
{
extern LinearContext context;
void LinearSystem::clear( void )
// removes all equations from the system
{
equations.clear();
}
void LinearSystem::push_back( const LinearEquation& e )
// appends the equation e to the sytem
{
equations.push_back( e );
}
void LinearSystem::solve( void )
// solves the system and automatically stores the result in the variables
// for an overdetermined system, computes a least-squares solution
{
convertEquations();
indexVariables();
buildSparseMatrix();
buildRightHandSide();
computeSolution();
}
void LinearSystem::convertEquations( void )
// converts each equation to its polynomial representation
{
currentEquations.clear();
for( EqnIter eqn = equations.begin();
eqn != equations.end();
eqn ++ )
{
// move right-hand side to left-hand side
LinearPolynomial p = eqn->lhs - eqn->rhs;
// convert fixed variables to constants
LinearPolynomial q( p.constantTerm );
for( TermIter t = p.linearTerms.begin();
t != p.linearTerms.end();
t ++ )
{
const double& coefficient( t->second );
Variable& variable( *(t->first) );
// skip zeros
if( coefficient == 0. ) continue;
if( t->first->fixed )
{
q += coefficient * variable.value;
}
else
{
q += coefficient * variable;
}
}
if( q.linearTerms.size() > 0 )
{
currentEquations.push_back( q );
}
}
nEquations = currentEquations.size();
}
void LinearSystem::indexVariables( void )
// assign a unique index to each variable remaining in one of the polynomials
{
index.clear();
nVariables = 0;
for( PolyCIter p = currentEquations.begin();
p != currentEquations.end();
p ++ )
{
for( TermCIter t = p->linearTerms.begin();
t != p->linearTerms.end();
t ++ )
{
IndexIter j = index.find( t->first );
// if we haven't seen this variable
// before, assign it a unique index
if( j == index.end() )
{
index[ t->first ] = nVariables;
nVariables++;
}
}
}
}
void LinearSystem::buildSparseMatrix( void )
// build the sparse matrix representation of our current system
{
A = SparseMatrix<Real>( nEquations, nVariables );
for( int i = 0; i < nEquations; i++ )
{
for( TermCIter t = currentEquations[i].linearTerms.begin();
t != currentEquations[i].linearTerms.end();
t ++ )
{
int j = index[ t->first ];
A(i,j) = t->second;
}
}
}
void LinearSystem::buildRightHandSide( void )
// build the data vector for our current system
{
b = DenseMatrix<Real>( nEquations, 1 );
for( int i = 0; i < nEquations; i++ )
{
b(i) = -currentEquations[i].constantTerm;
}
}
void LinearSystem::computeSolution( void )
{
// solve linear system Ax=b
x = SuiteSparseQR<double>( A.to_cholmod(), b.to_cholmod(), context );
// put solution values in variables
for( IndexIter i = index.begin();
i != index.end();
i ++ )
{
i->first->value = x( i->second );
}
}
}
================================================
FILE: BaseCode/src/Mesh.cpp
================================================
#include <map>
#include <fstream>
#include "Mesh.h"
#include "MeshIO.h"
#include "DiscreteExteriorCalculus.h"
using namespace std;
namespace DDG
{
Mesh :: Mesh( void )
{}
Mesh :: Mesh( const Mesh& mesh )
{
*this = mesh;
}
class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeIter& i, const HalfEdgeIter& j ) const { return &*i < &*j; } };
class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCIter& i, const HalfEdgeCIter& j ) const { return &*i < &*j; } };
class VertexIterCompare { public: bool operator()( const VertexIter& i, const VertexIter& j ) const { return &*i < &*j; } };
class VertexCIterCompare { public: bool operator()( const VertexCIter& i, const VertexCIter& j ) const { return &*i < &*j; } };
class FaceIterCompare { public: bool operator()( const FaceIter& i, const FaceIter& j ) const { return &*i < &*j; } };
class FaceCIterCompare { public: bool operator()( const FaceCIter& i, const FaceCIter& j ) const { return &*i < &*j; } };
class EdgeIterCompare { public: bool operator()( const EdgeIter& i, const EdgeIter& j ) const { return &*i < &*j; } };
class EdgeCIterCompare { public: bool operator()( const EdgeCIter& i, const EdgeCIter& j ) const { return &*i < &*j; } };
const Mesh& Mesh :: operator=( const Mesh& mesh )
{
map< HalfEdgeCIter, HalfEdgeIter, HalfEdgeCIterCompare > halfedgeOldToNew;
map< VertexCIter, VertexIter, VertexCIterCompare > vertexOldToNew;
map< EdgeCIter, EdgeIter, EdgeCIterCompare > edgeOldToNew;
map< FaceCIter, FaceIter, FaceCIterCompare > faceOldToNew;
// copy geometry from the original mesh and create a
// map from pointers in the original mesh to
// those in the new mesh
halfedges.clear();
for( HalfEdgeCIter he = mesh.halfedges.begin(); he != mesh.halfedges.end(); he++ )
halfedgeOldToNew[ he ] = halfedges.insert( halfedges.end(), *he );
vertices.clear();
for( VertexCIter v = mesh.vertices.begin(); v != mesh.vertices.end(); v++ )
vertexOldToNew[ v ] = vertices.insert( vertices.end(), *v );
edges.clear();
for( EdgeCIter e = mesh.edges.begin(); e != mesh.edges.end(); e++ )
edgeOldToNew[ e ] = edges.insert( edges.end(), *e );
faces.clear();
for( FaceCIter f = mesh.faces.begin(); f != mesh.faces.end(); f++ )
faceOldToNew[ f ] = faces.insert( faces.end(), *f );
// "search and replace" old pointers with new ones
for( HalfEdgeIter he = halfedges.begin(); he != halfedges.end(); he++ )
{
he->next = halfedgeOldToNew[ he->next ];
he->flip = halfedgeOldToNew[ he->flip ];
he->vertex = vertexOldToNew[ he->vertex ];
he->edge = edgeOldToNew[ he->edge ];
he->face = faceOldToNew[ he->face ];
}
for( VertexIter v = vertices.begin(); v != vertices.end(); v++ ) v->he = halfedgeOldToNew[ v->he ];
for( EdgeIter e = edges.begin(); e != edges.end(); e++ ) e->he = halfedgeOldToNew[ e->he ];
for( FaceIter f = faces.begin(); f != faces.end(); f++ ) f->he = halfedgeOldToNew[ f->he ];
return *this;
}
int Mesh::read( const string& filename )
{
inputFilename = filename;
ifstream in( filename.c_str() );
if( !in.is_open() )
{
cerr << "Error reading from mesh file " << filename << endl;
return 1;
}
int rval;
if( !( rval = MeshIO::read( in, *this )))
{
indexElements();
normalize();
}
return rval;
}
int Mesh::write( const string& filename ) const
// reads a mesh from a Wavefront OBJ file; return value is nonzero
// only if there was an error
{
ofstream out( filename.c_str() );
if( !out.is_open() )
{
cerr << "Error writing to mesh file " << filename << endl;
return 1;
}
MeshIO::write( out, *this );
return 0;
}
bool Mesh::reload( void )
{
return read( inputFilename );
}
void Mesh::normalize( void )
{
// compute center of mass
Vector c( 0., 0., 0. );
for( VertexCIter v = vertices.begin(); v != vertices.end(); v++ )
{
c += v->position;
}
c /= (double) vertices.size();
// translate to origin
for( VertexIter v = vertices.begin(); v != vertices.end(); v++ )
{
v->position -= c;
}
// rescale such that the mesh sits inside the unit ball
double rMax = 0.;
for( VertexCIter v = vertices.begin(); v != vertices.end(); v++ )
{
rMax = max( rMax, v->position.norm() );
}
for( VertexIter v = vertices.begin(); v != vertices.end(); v++ )
{
v->position /= rMax;
}
}
void Mesh::indexElements( void )
{
int nV = 0;
for( VertexIter v = vertices.begin(); v != vertices.end(); v++ )
{
v->index = nV;
nV++;
}
int nE = 0;
for( EdgeIter e = edges.begin(); e != edges.end(); e++ )
{
e->index = nE;
nE++;
}
int nF = 0;
for( FaceIter f = faces.begin(); f != faces.end(); f++ )
{
f->index = nF;
nF++;
}
}
double Mesh::area( void ) const
{
double sum = 0.0;
for( FaceCIter f = faces.begin();
f != faces.end();
f ++ )
{
sum += f->area();
}
return sum;
}
double Mesh::meanEdgeLength( void ) const
{
double sum = 0;
for( EdgeCIter e = edges.begin();
e != edges.end();
e ++)
{
VertexIter v0 = e->he->vertex;
VertexIter v1 = e->he->flip->vertex;
sum += (v0->position - v1->position).norm();
}
return sum / edges.size();
}
}
================================================
FILE: BaseCode/src/MeshIO.cpp
================================================
#include <vector>
#include <iostream>
#include <map>
#include <set>
#include "MeshIO.h"
#include "Mesh.h"
using namespace std;
namespace DDG
{
class Index
{
public:
Index( void )
{}
Index( int p, int t, int n )
: position( p ), texcoord( t ), normal( n )
{}
bool operator<( const Index& i ) const
{
if( position < i.position ) return true;
if( position > i.position ) return false;
if( texcoord < i.texcoord ) return true;
if( texcoord > i.texcoord ) return false;
if( normal < i.normal ) return true;
if( normal > i.normal ) return false;
return false;
}
int position;
int texcoord;
int normal;
};
class MeshData
{
public:
std::vector<Vector> positions;
std::vector<Vector> texcoords;
std::vector<Vector> normals;
std::vector< std::vector< Index > > indices;
};
int MeshIO :: read( istream& in, Mesh& mesh )
// reads a mesh from a valid, open input stream in
{
MeshData data;
if( readMeshData( in, data ))
{
return 1;
}
if( buildMesh( data, mesh ))
{
return 1;
}
return 0;
}
void MeshIO :: write( ostream& out, const Mesh& mesh )
// writes a mesh to a valid, open output stream out
{
int currentIndex = 1;
map<VertexCIter,int> vertexIndex;
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v++ )
{
out << "v " << v->position.x << " "
<< v->position.y << " "
<< v->position.z << endl;
vertexIndex[ v ] = currentIndex;
currentIndex++;
}
for( FaceCIter f = mesh.faces.begin();
f != mesh.faces.end();
f ++ )
{
HalfEdgeIter he = f->he;
for( int j = 0; j < 3; j++ )
{
out << "vt " << he->texcoord.x << " " << he->texcoord.y << endl;
he = he->next;
}
}
for( size_t i = 0; i < mesh.faces.size(); i++ )
{
const Face& f( mesh.faces[i] );
HalfEdgeIter he = f.he;
out << "f ";
int j = 0;
do
{
out << vertexIndex[ he->vertex ] << "/" << 1+(i*3+j) << " ";
he = he->next;
j++;
}
while( he != f.he );
out << endl;
}
}
int MeshIO :: readMeshData( istream& in, MeshData& data )
{
string line;
while( getline( in, line ))
{
stringstream ss( line );
string token;
ss >> token;
if( token == "v" ) { readPosition( ss, data ); continue; } // vertex
if( token == "vt" ) { readTexCoord( ss, data ); continue; } // texture coordinate
if( token == "vn" ) { readNormal ( ss, data ); continue; } // vertex normal
if( token == "f" ) { readFace ( ss, data ); continue; } // face
if( token[0] == '#' ) continue; // comment
if( token == "o" ) continue; // object name
if( token == "g" ) continue; // group name
if( token == "s" ) continue; // smoothing group
if( token == "mtllib" ) continue; // material library
if( token == "usemtl" ) continue; // material
if( token == "" ) continue; // empty string
cerr << "Error: does not appear to be a valid Wavefront OBJ file!" << endl;
cerr << "(Offending line: " << line << ")" << endl;
return 1;
}
return 0;
}
void MeshIO :: preallocateMeshElements( const MeshData& data, Mesh& mesh )
{
// count the number of edges
set< pair<int,int> > edges;
for( vector< vector< Index > >::const_iterator f = data.indices.begin();
f != data.indices.end();
f ++ )
{
for( unsigned int I = 0; I < f->size(); I++ )
{
int J = (I+1) % f->size();
int i = (*f)[I].position;
int j = (*f)[J].position;
if( i > j ) swap( i, j );
edges.insert( pair<int,int>( i, j ));
}
}
int nV = data.positions.size();
int nE = edges.size();
int nF = data.indices.size();
int nHE = 2*nE;
int chi = nV - nE + nF;
int nB = max( 0, 2 - chi ); // (conservative approximation of number of boundary cycles)
mesh.halfedges.clear();
mesh.vertices.clear();
mesh.edges.clear();
mesh.faces.clear();
mesh.boundaries.clear();
mesh.halfedges.reserve( nHE );
mesh.vertices.reserve( nV );
mesh.edges.reserve( nE );
mesh.faces.reserve( nF );
mesh.boundaries.reserve( nB );
}
extern vector<HalfEdge> isolated; // all isolated vertices point to isolated.begin()
int MeshIO :: buildMesh( const MeshData& data, Mesh& mesh )
{
map< pair< int, int >, int > edgeCount;
map< pair< int, int >, HalfEdgeIter > existingHalfEdges;
map< int, VertexIter > indexToVertex;
map< HalfEdgeIter, bool > hasFlipEdge;
preallocateMeshElements( data, mesh );
// allocate a vertex for each position in the data and construct
// a map from vertex indices to vertex pointers
for( unsigned int i = 0; i < data.positions.size(); i++ )
{
VertexIter newVertex = mesh.vertices.insert( mesh.vertices.end(), Vertex() );
newVertex->position = data.positions[ i ];
newVertex->he = isolated.begin();
indexToVertex[ i ] = newVertex;
}
// insert each face into the mesh
int faceIndex = 0;
bool degenerateFaces = false;
for( vector< vector< Index > >::const_iterator f = data.indices.begin();
f != data.indices.end();
f ++ )
{
int N = f->size();
// print an error if the face is degenerate
if( N < 3 )
{
cerr << "Error: face " << faceIndex << " is degenerate (fewer than three vertices)!" << endl;
degenerateFaces = true;
continue;
}
// create a new face
FaceIter newFace = mesh.faces.insert( mesh.faces.end(), Face());
// create a new half edge for each edge of the current face
vector< HalfEdgeIter > hes( N );
for( int i = 0; i < N; i++ )
{
hes[ i ] = mesh.halfedges.insert( mesh.halfedges.end(), HalfEdge());
}
// initialize these new halfedges
for( int i = 0; i < N; i++ )
{
// the current halfedge goes from vertex a to vertex b
int a = (*f)[ i ].position;
int b = (*f)[ (i+1) % N ].position;
// set current halfedge's attributes
hes[ i ]->next = hes[ (i+1) % N ];
hes[ i ]->vertex = indexToVertex[ a ];
int t = (*f)[i].texcoord;
if( t >= 0 ) hes[ i ]->texcoord = data.texcoords[ t ];
else hes[ i ]->texcoord = Vector( 0., 0., 0. );
hes[ i ]->onBoundary = false;
// keep track of which halfedges have flip edges defined (for detecting boundaries)
hasFlipEdge[ hes[ i ]] = false;
// point vertex a at the current halfedge
indexToVertex[ a ]->he = hes[ i ];
// point the new face and this half edge to each-other
hes[ i ]->face = newFace;
newFace->he = hes[ i ];
// if we've created an edge between a and b in the past, it is the
// flip edge of the current halfedge
if( a > b ) swap( a, b );
if( existingHalfEdges.find( pair<int,int>( a, b )) != existingHalfEdges.end())
{
hes[ i ]->flip = existingHalfEdges[ pair<int,int>( a, b ) ];
hes[ i ]->flip->flip = hes[ i ];
hes[ i ]->edge = hes[ i ]->flip->edge;
hasFlipEdge[ hes[ i ]] = true;
hasFlipEdge[ hes[ i ]->flip ] = true;
}
else // otherwise, create an edge connected to the current halfedge
{
hes[ i ]->edge = mesh.edges.insert( mesh.edges.end(), Edge());
hes[ i ]->edge->he = hes[i];
edgeCount[ pair<int,int>( a, b ) ] = 0;
}
// record the fact that we've created a halfedge from a to b
existingHalfEdges[ pair<int,int>( a, b ) ] = hes[ i ];
// check for nonmanifold edges
edgeCount[ pair<int,int>( a, b ) ]++;
if( edgeCount[ pair<int,int>( a, b ) ] > 2 )
{
cerr << "Error: edge (" << a << ", " << b << ") is nonmanifold (more than two faces sharing a single edge)!" << endl;
return 1;
}
}
faceIndex++;
}
// give up now if there were degenerate faces
if( degenerateFaces )
{
return 1;
}
// insert extra faces for each boundary cycle
for( HalfEdgeIter currentHE = mesh.halfedges.begin();
currentHE != mesh.halfedges.end();
currentHE ++ )
{
// if we find a halfedge with no flip edge defined, create
// a new face and link it to the corresponding boundary cycle
if( !hasFlipEdge[ currentHE ] )
{
// create a new face
FaceIter newBoundary = mesh.boundaries.insert( mesh.boundaries.end(), Face());
// walk along this boundary cycle
vector<HalfEdgeIter> boundaryCycle;
HalfEdgeIter he = currentHE;
do
{
// create a new halfedge on the boundary face
HalfEdgeIter newHE = mesh.halfedges.insert( mesh.halfedges.end(), HalfEdge());
// mark only the halfedge on the boundary face as being on the boundary
newHE->onBoundary = true;
// link the current halfedge in the cycle to its new flip edge
he->flip = newHE;
// grab the next halfedge along the boundary by finding
// the next halfedge around the current vertex that doesn't
// have a flip edge defined
HalfEdgeIter nextHE = he->next;
while( hasFlipEdge[ nextHE ] )
{
nextHE = nextHE->flip->next;
}
// set attributes for the flip edge (we'll set ->next below)
newHE->flip = he;
newHE->vertex = nextHE->vertex;
newHE->edge = he->edge;
newHE->face = newBoundary;
newHE->texcoord = nextHE->texcoord;
// point the new face to this half edge
newBoundary->he = newHE;
// keep track of all the new halfedges in the boundary cycle
boundaryCycle.push_back( newHE );
// continue to walk along the cycle
he = nextHE;
} while( he != currentHE );
// link together the cycle of boundary halfedges
unsigned int N = boundaryCycle.size();
for( unsigned int i = 0; i < N; i++ )
{
boundaryCycle[ i ]->next = boundaryCycle[ (i+N-1)%N ];
hasFlipEdge[ boundaryCycle[i] ] = true;
hasFlipEdge[ boundaryCycle[i]->flip ] = true;
}
}
}
// print a warning if the input has any non-terminal defects
checkIsolatedVertices( mesh );
checkNonManifoldVertices( mesh );
return 0;
}
void MeshIO :: readPosition( stringstream& ss, MeshData& data )
{
double x, y, z;
ss >> x >> y >> z;
data.positions.push_back( Vector( x, y, z ));
}
void MeshIO :: readTexCoord( stringstream& ss, MeshData& data )
{
double u, v;
ss >> u >> v;
data.texcoords.push_back( Vector( u, v, 0. ));
}
void MeshIO :: readNormal( stringstream& ss, MeshData& data )
{
double x, y, z;
ss >> x >> y >> z;
data.normals.push_back( Vector( x, y, z ));
}
void MeshIO :: readFace( stringstream& ss, MeshData &data )
{
vector<Index> faceIndices;
string token;
while( ss >> token )
{
faceIndices.push_back( parseFaceIndex( token ));
}
data.indices.push_back( faceIndices );
}
Index MeshIO :: parseFaceIndex( const string& token )
{
// parse indices of the form
//
// p/[t]/[n]
//
// where p is an index into positions, t is an index into
// texcoords, n is an index into normals, and [.] indicates
// that an index is optional
stringstream in( token );
string indexstring;
int indices[3] = { -1, -1, -1 };
int i = 0;
while( getline( in, indexstring, '/' ))
{
stringstream ss( indexstring );
ss >> indices[i++];
}
// decrement since indices in OBJ files are 1-based
return Index( indices[0]-1,
indices[1]-1,
indices[2]-1 );
}
void MeshIO :: checkIsolatedVertices( const Mesh& mesh )
{
// print a warning if the mesh has any isolated vertices
int vertexIndex = 0;
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
if( v->isIsolated() )
{
cerr << "Warning: vertex " << vertexIndex << " is isolated (not contained in any face)." << endl;
}
vertexIndex++;
}
}
void MeshIO :: checkNonManifoldVertices( const Mesh& mesh )
{
map<VertexCIter,int> nIncidentFaces;
for( FaceCIter f = mesh.faces.begin();
f != mesh.faces.end();
f ++ )
{
HalfEdgeCIter he = f->he;
do
{
nIncidentFaces[he->vertex]++;
he = he->next;
}
while( he != f->he );
}
for( FaceCIter f = mesh.boundaries.begin();
f != mesh.boundaries.end();
f ++ )
{
HalfEdgeCIter he = f->he;
do
{
nIncidentFaces[he->vertex]++;
he = he->next;
}
while( he != f->he );
}
int vertexIndex = 0;
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
if( nIncidentFaces[v] != v->valence() )
{
cerr << "Warning: vertex " << vertexIndex << " is nonmanifold." << endl;
}
vertexIndex++;
}
}
}
================================================
FILE: BaseCode/src/Quaternion.cpp
================================================
#include <cmath>
#include <iostream>
using namespace std;
#include "Quaternion.h"
namespace DDG
{
// CONSTRUCTORS ----------------------------------------------------------
Quaternion :: Quaternion( void )
// initializes all components to zero
: s( 0. ),
v( 0., 0., 0. )
{}
Quaternion :: Quaternion( const Quaternion& q )
// initializes from existing quaternion
: s( q.s ),
v( q.v )
{}
Quaternion :: Quaternion( double s_, double vi, double vj, double vk )
// initializes with specified double (s) and imaginary (v) components
: s( s_ ),
v( vi, vj, vk )
{}
Quaternion :: Quaternion( double s_, const Vector& v_ )
// initializes with specified double(s) and imaginary (v) components
: s( s_ ),
v( v_ )
{}
Quaternion :: Quaternion( double s_ )
// initializes purely real quaternion with specified real (s) component (imaginary part is zero)
: s( s_ ),
v( 0., 0., 0. )
{}
Quaternion :: Quaternion( const Vector& v_ )
// initializes purely imaginary quaternion with specified imaginary (v) component (real part is zero)
: s( 0. ),
v( v_ )
{}
Quaternion :: Quaternion( const Complex& z )
// for a complex number z=a+bi, initializes quaternion to a+bi+0j+0k
: s( z.re ),
v( z.im, 0., 0. )
{}
// ASSIGNMENT OPERATORS --------------------------------------------------
const Quaternion& Quaternion :: operator=( double _s )
// assigns a purely real quaternion with real value s
{
s = _s;
v = Vector( 0., 0., 0. );
return *this;
}
const Quaternion& Quaternion :: operator=( const Vector& _v )
// assigns a purely real quaternion with imaginary value v
{
s = 0.;
v = _v;
return *this;
}
// ACCESSORS -------------------------------------------------------------
double& Quaternion::operator[]( int index )
// returns reference to the specified component (0-based indexing: double, i, j, k)
{
return ( &s )[ index ];
}
const double& Quaternion::operator[]( int index ) const
// returns const reference to the specified component (0-based indexing: double, i, j, k)
{
return ( &s )[ index ];
}
void Quaternion::toMatrix( double Q[4][4] ) const
// returns 4x4 matrix representation
{
Q[0][0] = s; Q[0][1] = -v.x; Q[0][2] = -v.y; Q[0][3] = -v.z;
Q[1][0] = v.x; Q[1][1] = s; Q[1][2] = -v.z; Q[1][3] = v.y;
Q[2][0] = v.y; Q[2][1] = v.z; Q[2][2] = s; Q[2][3] = -v.x;
Q[3][0] = v.z; Q[3][1] = -v.y; Q[3][2] = v.x; Q[3][3] = s;
}
double& Quaternion::re( void )
// returns reference to double part
{
return s;
}
const double& Quaternion::re( void ) const
// returns const reference to double part
{
return s;
}
Vector& Quaternion::im( void )
// returns reference to imaginary part
{
return v;
}
const Vector& Quaternion::im( void ) const
// returns const reference to imaginary part
{
return v;
}
// VECTOR SPACE OPERATIONS -----------------------------------------------
Quaternion Quaternion::operator+( const Quaternion& q ) const
// addition
{
return Quaternion( s+q.s, v+q.v );
}
Quaternion Quaternion::operator-( const Quaternion& q ) const
// subtraction
{
return Quaternion( s-q.s, v-q.v );
}
Quaternion Quaternion::operator-( void ) const
// negation
{
return Quaternion( -s, -v );
}
Quaternion Quaternion::operator*( double c ) const
// scalar multiplication
{
return Quaternion( s*c, v*c );
}
Quaternion operator*( double c, const Quaternion& q )
// scalar multiplication
{
return q*c;
}
Quaternion Quaternion::operator/( double c ) const
// scalar division
{
return Quaternion( s/c, v/c );
}
void Quaternion::operator+=( const Quaternion& q )
// addition / assignment
{
s += q.s;
v += q.v;
}
void Quaternion::operator+=( double c )
// addition / assignment of pure real
{
s += c;
}
void Quaternion::operator-=( const Quaternion& q )
// subtraction / assignment
{
s -= q.s;
v -= q.v;
}
void Quaternion::operator-=( double c )
// subtraction / assignment of pure real
{
s -= c;
}
void Quaternion::operator*=( double c )
// scalar multiplication / assignment
{
s *= c;
v *= c;
}
void Quaternion::operator/=( double c )
// scalar division / assignment
{
s /= c;
v /= c;
}
// ALGEBRAIC OPERATIONS --------------------------------------------------
Quaternion Quaternion::operator*( const Quaternion& q ) const
// Hamilton product
{
const double& s1( s );
const double& s2( q.s );
const Vector& v1( v );
const Vector& v2( q.v );
return Quaternion( s1*s2 - dot(v1,v2), s1*v2 + s2*v1 + cross(v1,v2) );
}
void Quaternion::operator*=( const Quaternion& q )
// Hamilton product / assignment
{
*this = ( *this * q );
}
Quaternion Quaternion::conj( void ) const
// conjugation
{
return Quaternion( s, -v );
}
Quaternion Quaternion::inv( void ) const
{
return ( this->conj() ) / this->norm2();
}
// NORMS -----------------------------------------------------------------
double Quaternion::norm( void ) const
// returns Euclidean length
{
return sqrt( s*s + v.x*v.x + v.y*v.y + v.z*v.z );
}
double Quaternion::norm2( void ) const
// returns Euclidean length squared
{
return s*s + dot(v,v);
}
Quaternion Quaternion::unit( void ) const
// returns unit quaternion
{
return *this / norm();
}
void Quaternion::normalize( void )
// divides by Euclidean length
{
*this /= norm();
}
// GEOMETRIC OPERATIONS --------------------------------------------------
Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
// spherical-linear interpolation
{
// interpolate length
double m0 = q0.norm();
double m1 = q1.norm();
double m = (1-t)*m0 + t*m1;
// interpolate direction
Quaternion p0 = q0 / m0;
Quaternion p1 = q1 / m1;
double theta = acos(( p0.conj()*p1 ).re() );
Quaternion p = ( sin((1-t)*theta)*p0 + sin(t*theta)*p1 )/sin(theta);
return m*p;
}
// I/O -------------------------------------------------------------------------
std::ostream& operator<<( std::ostream& os, const Quaternion& q )
// prints components
{
os << "( " << q.re() << ", " << q.im() << " )";
return os;
}
}
================================================
FILE: BaseCode/src/Real.cpp
================================================
#include "Real.h"
#include <cmath>
namespace DDG
{
Real :: Real( double x )
// constructs real number with value x
: value( x )
{}
Real :: operator double( void ) const
// type cast to double
{
return value;
}
void Real :: operator+=( double x )
// increment
{
value += x;
}
void Real :: operator-=( double x )
// decrement
{
value -= x;
}
void Real :: operator*=( double x )
// multiply
{
value *= x;
}
void Real :: operator/=( double x )
// divide
{
value /= x;
}
Real Real :: conj( void ) const
// simply returns the value (for compatibility w/ complex numbers)
{
return value;
}
Real Real :: inv( void ) const
// returns inverse
{
return 1. / value;
}
double Real :: norm( void ) const
// returns norm
{
return fabs( value );
}
double Real :: norm2( void ) const
// returns norm squared
{
return value * value;
}
Real Real :: unit( void ) const
// returns number with unit norm and same sign
{
return value / norm();
}
}
================================================
FILE: BaseCode/src/Shader.cpp
================================================
#include "Shader.h"
#include <fstream>
#include <iostream>
using namespace std;
namespace DDG
{
Shader::Shader( void )
// constructor -- shader is initially invalid
: vertexShader( 0 ),
fragmentShader( 0 ),
geometryShader( 0 ),
program( 0 ),
linked( false )
{}
Shader::~Shader( void )
{
if( program ) glDeleteProgram( program );
if( vertexShader ) glDeleteShader( vertexShader );
if( fragmentShader ) glDeleteShader( fragmentShader );
if( geometryShader ) glDeleteShader( geometryShader );
}
void Shader::loadVertex( const char* filename )
{
load( GL_VERTEX_SHADER, filename, vertexShader );
}
void Shader::loadFragment( const char* filename )
{
load( GL_FRAGMENT_SHADER, filename, fragmentShader );
}
void Shader::loadGeometry( const char* filename )
{
#ifdef GL_GEOMETRY_SHADER_EXT
load( GL_GEOMETRY_SHADER_EXT, filename, geometryShader );
#else
cerr << "Error: geometry shaders not supported!" << endl;
#endif
}
void Shader::enable( void )
{
if( !linked )
{
glLinkProgram( program );
linked = true;
}
glUseProgram( program );
}
void Shader::disable( void ) const
{
glUseProgram( 0 );
}
Shader::operator GLuint( void ) const
{
return program;
}
void Shader::load( GLenum shaderType, const char* filename, GLuint& shader )
// read vertex shader from GLSL source file, compile, and attach to program
{
string source;
if( !readSource( filename, source ))
{
return;
}
if( program == 0 )
{
program = glCreateProgram();
}
if( shader != 0 )
{
glDetachShader( program, shader );
}
shader = glCreateShader( shaderType );
const char* source_c_str = source.c_str();
glShaderSource( shader, 1, &(source_c_str), NULL );
glCompileShader( shader );
GLint compileStatus;
glGetShaderiv( shader, GL_COMPILE_STATUS, &compileStatus );
if( compileStatus == GL_TRUE )
{
glAttachShader( program, shader );
linked = false;
}
else
{
GLsizei maxLength = 0;
glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &maxLength );
if( maxLength > 0 )
{
GLchar* infoLog = new char[ maxLength ];
GLsizei length;
glGetShaderInfoLog( shader, maxLength, &length, infoLog );
cerr << "GLSL Error: " << infoLog << endl;
delete[] infoLog;
}
}
}
bool Shader::readSource( const char* filename, std::string& source )
// reads GLSL source file into a string
{
source = "";
ifstream in( filename );
if( !in.is_open() )
{
cerr << "Error: could not open shader file ";
cerr << filename;
cerr << " for input!" << endl;
return false;
}
string line;
while( getline( in, line ))
{
source += line;
}
return true;
}
}
================================================
FILE: BaseCode/src/SparseMatrix.cpp
================================================
#include "SparseMatrix.h"
namespace DDG
{
template <>
const SparseMatrix<Real>& SparseMatrix<Real> :: operator=( cholmod_sparse* B )
{
assert( B );
assert( B->xtype == CHOLMOD_REAL );
if( cData )
{
cholmod_l_free_sparse( &cData, context );
}
cData = B;
m = cData->nrow;
n = cData->ncol;
resize( m, n );
double* pr = (double*) cData->x;
UF_long* ir = (UF_long*) cData->i;
UF_long* jc = (UF_long*) cData->p;
// iterate over columns
for( int col = 0; col < n; col++ )
{
// iterate over nonzero rows
for( int k = jc[col]; k < jc[col+1]; k++ )
{
int row = ir[k];
(*this)( row, col ) = pr[k];
}
}
return *this;
}
template <>
const SparseMatrix<Complex>& SparseMatrix<Complex> :: operator=( cholmod_sparse* B )
{
assert( B );
assert( B->xtype == CHOLMOD_COMPLEX );
if( cData )
{
cholmod_l_free_sparse( &cData, context );
}
cData = B;
m = cData->nrow;
n = cData->ncol;
resize( m, n );
double* pr = (double*) cData->x;
UF_long* ir = (UF_long*) cData->i;
UF_long* jc = (UF_long*) cData->p;
// iterate over columns
for( int col = 0; col < n; col++ )
{
// iterate over nonzero rows
for( int k = jc[col]; k < jc[col+1]; k++ )
{
int row = ir[k];
(*this)( row, col ) = Complex( pr[k*2+0], pr[k*2+1] );
}
}
return *this;
}
template <>
cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
{
SparseMatrix<Real> A( m*4, n*4 );
for( const_iterator e = begin();
e != end();
e ++ )
{
int i = e->first.second;
int j = e->first.first;
const Quaternion& q( e->second );
A(i*4+0,j*4+0) = q[0]; A(i*4+0,j*4+1) = -q[1]; A(i*4+0,j*4+2) = -q[2]; A(i*4+0,j*4+3) = -q[3];
A(i*4+1,j*4+0) = q[1]; A(i*4+1,j*4+1) = q[0]; A(i*4+1,j*4+2) = -q[3]; A(i*4+1,j*4+3) = q[2];
A(i*4+2,j*4+0) = q[2]; A(i*4+2,j*4+1) = q[3]; A(i*4+2,j*4+2) = q[0]; A(i*4+2,j*4+3) = -q[1];
A(i*4+3,j*4+0) = q[3]; A(i*4+3,j*4+1) = -q[2]; A(i*4+3,j*4+2) = q[1]; A(i*4+3,j*4+3) = q[0];
}
if( cData != NULL )
{
cholmod_l_free_sparse( &cData, context );
}
cData = cholmod_l_copy_sparse( A.to_cholmod(), context );
return cData;
}
template <>
void SparseMatrix<Real> :: allocateSparse( void )
{
int nzmax = data.size();
int sorted = true;
int packed = true;
int stype = 0;
cData = cholmod_l_allocate_sparse( m, n, nzmax, sorted, packed, stype, CHOLMOD_REAL, context );
}
template <>
void SparseMatrix<Complex> :: allocateSparse( void )
{
int nzmax = data.size();
int sorted = true;
int packed = true;
int stype = 0;
cData = cholmod_l_allocate_sparse( m, n, nzmax, sorted, packed, stype, CHOLMOD_COMPLEX, context );
}
template <>
void SparseMatrix<Quaternion> :: allocateSparse( void )
{
int nzmax = data.size();
int sorted = true;
int packed = true;
int stype = 0;
cData = cholmod_l_allocate_sparse( m*4, n*4, nzmax, sorted, packed, stype, CHOLMOD_REAL, context );
}
template <>
void SparseMatrix<Real> :: setEntry( const_iterator e, int i, double* pr )
{
pr[i] = e->second;
}
template <>
void SparseMatrix<Complex> :: setEntry( const_iterator e, int i, double* pr )
{
pr[i*2+0] = e->second.re;
pr[i*2+1] = e->second.im;
}
template <>
void solve( SparseMatrix<Real>& A,
DenseMatrix<Real>& x,
DenseMatrix<Real>& b )
// solves the sparse linear system Ax = b using sparse QR factorization
{
int t0 = clock();
x = SuiteSparseQR<double>( A.to_cholmod(), b.to_cholmod(), context );
int t1 = clock();
cout << "[qr] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[qr] max residual: " << residual( A, x, b ) << "\n";
cout << "[qr] size: " << A.nRows() << " x " << A.nColumns() << "\n";
cout << "[qr] rank: " << (*context).SPQR_istat[4] << "\n";
}
template <>
void solve( SparseMatrix<Complex>& A,
DenseMatrix<Complex>& x,
DenseMatrix<Complex>& b )
// solves the sparse linear system Ax = b using sparse QR factorization
{
int t0 = clock();
x = SuiteSparseQR< complex<double> >( A.to_cholmod(), b.to_cholmod(), context );
int t1 = clock();
cout << "[qr] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[qr] max residual: " << residual( A, x, b ) << "\n";
cout << "[qr] size: " << A.nRows() << " x " << A.nColumns() << " (complex)" << "\n";
cout << "[qr] rank: " << (*context).SPQR_istat[4] << "\n";
}
template <>
void solve( SparseMatrix<Quaternion>& A,
DenseMatrix<Quaternion>& x,
DenseMatrix<Quaternion>& b )
// solves the sparse linear system Ax = b using sparse QR factorization
{
int t0 = clock();
x = SuiteSparseQR<double>( A.to_cholmod(), b.to_cholmod(), context );
int t1 = clock();
cout << "[qr] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[qr] max residual: " << residual( A, x, b ) << "\n";
cout << "[qr] size: " << A.nRows() << " x " << A.nColumns() << " (quaternion)" << "\n";
cout << "[qr] rank: " << (*context).SPQR_istat[4]/4 << "\n";
}
template <>
void solveSymmetric( SparseMatrix<Complex>& A,
DenseMatrix<Complex>& x,
DenseMatrix<Complex>& b )
// solves the sparse linear system Ax = b using sparse LU factorization
{
int t0 = clock();
cholmod_sparse* Ac = A.to_cholmod();
int n = Ac->nrow;
UF_long* Ap = (UF_long*) Ac->p;
UF_long* Ai = (UF_long*) Ac->i;
double* Ax = (double*) Ac->x;
void* Symbolic;
void* Numeric;
umfpack_zl_symbolic( n, n, Ap, Ai, Ax, NULL, &Symbolic, NULL, NULL );
umfpack_zl_numeric( Ap, Ai, Ax, NULL, Symbolic, &Numeric, NULL, NULL );
umfpack_zl_solve( UMFPACK_A, Ap, Ai, Ax, NULL, (double*) &x(0), NULL, (double*) &b(0), NULL, Numeric, NULL, NULL );
umfpack_zl_free_symbolic( &Symbolic );
umfpack_zl_free_numeric( &Numeric );
int t1 = clock();
cout << "[lu] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[lu] max residual: " << residual( A, x, b ) << "\n";
}
}
================================================
FILE: BaseCode/src/SparseMatrix.inl
================================================
#include <algorithm>
#include <cassert>
#include <iostream>
#include <cmath>
#include <complex>
using namespace std;
#include <SuiteSparseQR.hpp>
#include <umfpack.h>
#include "Real.h"
#include "Complex.h"
#include "SparseMatrix.h"
#include "DenseMatrix.h"
#include "LinearContext.h"
#include "Utility.h"
namespace DDG
{
extern LinearContext context;
const int maxEigIter = 20;
// number of iterations used to solve eigenvalue problems
template <class T>
SparseMatrix<T> :: SparseMatrix( int m_, int n_ )
// initialize an mxn matrix
: m( m_ ),
n( n_ ),
cData( NULL )
{}
template <class T>
SparseMatrix<T> :: SparseMatrix( const SparseMatrix<T>& B )
// copy constructor
: cData( NULL )
{
*this = B;
}
template <class T>
SparseMatrix<T> :: ~SparseMatrix( void )
// destructor
{
if( cData )
{
cholmod_l_free_sparse( &cData, context );
}
}
template <class T>
const SparseMatrix<T>& SparseMatrix<T> :: operator=( const SparseMatrix<T>& B )
// copies B
{
if( cData )
{
cholmod_l_free_sparse( &cData, context );
cData = NULL;
}
m = B.m;
n = B.n;
data = B.data;
return *this;
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: transpose( void ) const
{
SparseMatrix<T> AT( n, m );
for( const_iterator e = begin();
e != end();
e++ )
{
int i = e->first.second;
int j = e->first.first;
T Aij = e->second;
AT(j,i) = Aij.conj();
}
return AT;
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: operator*( const SparseMatrix<T>& B ) const
// returns product of this matrix with sparse B
{
const SparseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nColumns() == B.nRows() );
// collect nonzeros in each row
vector< vector< int > > Bcol( B.nRows() );
vector< vector< T > > Bval( B.nRows() );
for( const_iterator e = B.begin();
e != B.end();
e ++ )
{
int row = e->first.second;
int col = e->first.first;
T val = e->second;
Bcol[ row ].push_back( col );
Bval[ row ].push_back( val );
}
// multiply C = A*B
SparseMatrix<T> C( A.nRows(), B.nColumns() );
for( const_iterator e = begin();
e != end();
e ++ )
{
int i = e->first.second;
int j = e->first.first;
for( size_t n = 0; n < Bcol[j].size(); n++ )
{
int k = Bcol[j][n];
C( i, k ) += e->second * Bval[j][n];
}
}
return C;
}
template <class T>
DenseMatrix<T> SparseMatrix<T> :: operator*( const DenseMatrix<T>& B ) const
// returns product of this matrix with dense B
{
const SparseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nColumns() == B.nRows() );
// multiply C = A*B
DenseMatrix<T> C( A.nRows(), B.nColumns() );
for( const_iterator e = begin();
e != end();
e ++ )
{
int i = e->first.second;
int j = e->first.first;
for( int k = 0; k < B.nColumns(); k++ )
{
C( i, k ) += e->second * B( j, k );
}
}
return C;
}
template <class T>
void SparseMatrix<T> :: operator*=( const T& c )
{
for( iterator e = begin();
e != end();
e++ )
{
e->second *= c;
}
}
template <class T>
void SparseMatrix<T> :: operator/=( const T& c )
{
for( iterator e = begin();
e != end();
e++ )
{
e->second /= c;
}
}
template <class T>
void SparseMatrix<T> :: operator+=( const SparseMatrix<T>& B )
// adds B to this matrix
{
SparseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
for( const_iterator e = B.begin();
e != B.end();
e++ )
{
int i = e->first.second;
int j = e->first.first;
const T& Bij( e->second );
A( i, j ) += Bij;
}
}
template <class T>
void SparseMatrix<T> :: operator-=( const SparseMatrix<T>& B )
// subtracts B from this matrix
{
SparseMatrix<T>& A( *this );
// make sure matrix dimensions agree
assert( A.nRows() == B.nRows() );
assert( A.nColumns() == B.nColumns() );
for( const_iterator e = B.begin();
e != B.end();
e++ )
{
int i = e->first.second;
int j = e->first.first;
const T& Bij( e->second );
A( i, j ) -= Bij;
}
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: operator+( const SparseMatrix<T>& B ) const
// returns sum of this matrix with B
{
SparseMatrix<T> C( nRows(), nColumns() );
C += *this;
C += B;
return C;
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: operator-( const SparseMatrix<T>& B ) const
// returns sum of this matrix with B
{
SparseMatrix<T> C( nRows(), nColumns() );
C += *this;
C -= B;
return C;
}
template <class T>
SparseMatrix<T> operator*( const T& c, const SparseMatrix<T>& A )
{
SparseMatrix<T> cA = A;
for( typename SparseMatrix<T>::iterator e = cA.begin();
e != cA.end();
e++ )
{
e->second = c * e->second;
}
return cA;
}
template <class T>
SparseMatrix<T> operator*( const SparseMatrix<T>& A, const T& c )
{
SparseMatrix<T> Ac = A;
Ac *= c;
return Ac;
}
template <class T>
SparseMatrix<T> operator/( const SparseMatrix<T>& A, T c )
{
SparseMatrix<T> Ac = A;
Ac /= c;
return Ac;
}
template <class T>
void SparseMatrix<T> :: resize( int m_, int n_ )
{
m = m_;
n = n_;
data.clear();
}
template <class T>
int SparseMatrix<T> :: nRows( void ) const
// returns the number of rows
{
return m;
}
template <class T>
int SparseMatrix<T> :: nColumns( void ) const
// returns the number of columns
{
return n;
}
template <class T>
int SparseMatrix<T> :: length( void ) const
// returns the size of the largest dimension
{
return max( m, n );
}
template <class T>
void SparseMatrix<T> :: zero( const T& val )
// sets all nonzero elements val
{
for( iterator i = begin(); i != end(); i++ )
{
i->second = val;
}
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: inverse( void ) const
// returns inverse -- for diagonal matrices only
{
assert( m == n ); // matrix must be square
const SparseMatrix<T>& A( *this );
SparseMatrix<T> Ainv( m, m );
for( const_iterator e = begin(); e != end(); e++ )
{
int r = e->first.second;
int c = e->first.first;
assert( r == c ); // matrix must be diagonal
Ainv( r, c ) = A( r, c ).inv();
}
return Ainv;
}
template <class T>
SparseMatrix<T> SparseMatrix<T> :: identity( int N )
{
SparseMatrix<T> I( N, N );
for( int i = 0; i < N; i++ )
{
I( i, i ) = 1.;
}
return I;
}
template <class T>
DenseMatrix<T> SparseMatrix<T> :: full( void ) const
// converts to a dense matrix
{
const int maxSize = 1048576;
if( m*n > maxSize )
{
cerr << "Error: refusing to convert sparse to dense (too big!)" << "\n";
exit( 1 );
}
const SparseMatrix<T>& A( *this );
DenseMatrix<T> B( m, n );
for( int i = 0; i < m; i++ )
for( int j = 0; j < m; j++ )
{
B( i, j ) = A( i, j );
}
return B;
}
template <class T>
cholmod_sparse* SparseMatrix<T> :: to_cholmod( void )
{
if( cData )
{
cholmod_l_free_sparse( &cData, context );
cData = NULL;
}
allocateSparse();
// build compressed matrix (note that EntryMap stores entries in column-major order)
double* pr = (double*) cData->x;
UF_long* ir = (UF_long*) cData->i;
UF_long* jc = (UF_long*) cData->p;
int i = 0;
int j = -1;
for( const_iterator e = begin();
e != end();
e ++ )
{
int c = e->first.first;
if( c != j )
{
for( int k = j+1; k <= c; k++ )
{
jc[k] = i;
}
j = c;
}
ir[i] = e->first.second;
setEntry( e, i, pr );
i++;
}
for( int k = j+1; k <= n; k++ )
{
jc[k] = i;
}
return cData;
}
template <>
cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void );
template <class T>
T& SparseMatrix<T> :: operator()( int row, int col )
{
EntryIndex index( col, row );
const_iterator entry = data.find( index );
if( entry == end())
{
data[ index ] = T( 0. );
}
return data[ index ];
}
template <class T>
T SparseMatrix<T> :: operator()( int row, int col ) const
{
EntryIndex index( col, row );
const_iterator entry = data.find( index );
if( entry == end())
{
return T( 0. );
}
return entry->second;
}
template <class T>
typename SparseMatrix<T>::iterator SparseMatrix<T> :: begin( void )
{
return data.begin();
}
template <class T>
typename SparseMatrix<T>::const_iterator SparseMatrix<T> :: begin( void ) const
{
return data.begin();
}
template <class T>
typename SparseMatrix<T>::iterator SparseMatrix<T> :: end( void )
{
return data.end();
}
template <class T>
typename SparseMatrix<T>::const_iterator SparseMatrix<T> :: end( void ) const
{
return data.end();
}
template <class T>
void SparseMatrix<T> :: shift( double c )
// adds c times the identity matrix to this matrix
{
assert( m == n );
SparseMatrix<T>& A( *this );
for( int i = 0; i < m; i++ )
{
A( i, i ) += c;
}
}
template <class T>
void solveSymmetric( SparseMatrix<T>& A,
DenseMatrix<T>& x,
DenseMatrix<T>& b )
// solves the sparse linear system Ax = b using sparse LU factorization
{
int t0 = clock();
cholmod_sparse* Ac = A.to_cholmod();
int n = Ac->nrow;
UF_long* Ap = (UF_long*) Ac->p;
UF_long* Ai = (UF_long*) Ac->i;
double* Ax = (double*) Ac->x;
void* Symbolic;
void* Numeric;
umfpack_dl_symbolic( n, n, Ap, Ai, Ax, &Symbolic, NULL, NULL );
umfpack_dl_numeric( Ap, Ai, Ax, Symbolic, &Numeric, NULL, NULL );
umfpack_dl_solve( UMFPACK_A, Ap, Ai, Ax, (double*) &x(0), (double*) &b(0), Numeric, NULL, NULL );
umfpack_dl_free_symbolic( &Symbolic );
umfpack_dl_free_numeric( &Numeric );
int t1 = clock();
cout << "[lu] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[lu] max residual: " << residual( A, x, b ) << "\n";
}
template <class T>
void solvePositiveDefinite( SparseMatrix<T>& A,
DenseMatrix<T>& x,
DenseMatrix<T>& b )
// solves the positive definite sparse linear system Ax = b using sparse Cholesky factorization
{
int t0 = clock();
cholmod_sparse* Ac = A.to_cholmod();
Ac->stype = 1;
cholmod_factor* L = cholmod_l_analyze( Ac, context );
cholmod_l_factorize( Ac, L, context );
x = cholmod_l_solve( CHOLMOD_A, L, b.to_cholmod(), context );
if( L ) cholmod_l_free_factor( &L, context );
int t1 = clock();
cout << "[chol] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[chol] max residual: " << residual( A, x, b ) << "\n";
}
template <class T>
void backsolvePositiveDefinite( SparseFactor<T>& L,
DenseMatrix<T>& x,
DenseMatrix<T>& b )
// backsolves the prefactored positive definite sparse linear system LL'x = b
{
x = cholmod_l_solve( CHOLMOD_A, L.to_cholmod(), b.to_cholmod(), context );
}
template <class T>
void smallestEig( SparseMatrix<T>& A,
DenseMatrix<T>& x,
bool ignoreConstantVector )
// solves A x = lambda x for the smallest nonzero eigenvalue lambda
// A must be symmetric; x is used as an initial guess
{
int t0 = clock();
for( int iter = 0; iter < maxEigIter; iter++ )
{
solve( A, x, x );
if( ignoreConstantVector )
{
x.removeMean();
}
x.normalize();
}
int t1 = clock();
cout << "[eig] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[eig] max residual: " << residual( A, x ) << "\n";
}
template <class T>
void smallestEig( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& x )
// solves A x = lambda B x for the smallest nonzero generalized eigenvalue lambda
// A and B must be symmetric; x is used as an initial guess
{
// TODO use a symmetric matrix decomposition instead of QR
int t0 = clock();
// create vector e that has unit norm w.r.t. B
int n = A.length();
DenseMatrix<T> e( n, 1 );
e.zero( 1. );
e /= dot( e, B*e ).norm();
DenseMatrix<T> Be = B*e;
for( int iter = 0; iter < maxEigIter; iter++ )
{
x = B*x;
solve( A, x, x );
x -= dot( x, Be ).conj()*e;
x /= dot( x, B*x ).norm();
}
int t1 = clock();
cout << "[eig] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[eig] max residual: " << residual( A, B, x ) << "\n";
}
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
DenseMatrix<T>& x,
bool ignoreConstantVector )
// solves A x = lambda x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite; x is used as an initial guess
{
int t0 = clock();
SparseFactor<T> L;
L.build( A );
for( int iter = 0; iter < maxEigIter; iter++ )
{
backsolvePositiveDefinite( L, x, x );
if( ignoreConstantVector )
{
x.removeMean();
}
x.normalize();
}
int t1 = clock();
cout << "[eig] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[eig] max residual: " << residual( A, x ) << "\n";
}
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& x )
// solves A x = lambda x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite; x is used as an initial guess
{
int t0 = clock();
SparseFactor<T> L;
L.build( A );
// create vector e that has unit norm w.r.t. B
int n = A.length();
DenseMatrix<T> e( n, 1 );
e.zero( 1. );
e /= sqrt( dot( e, B*e ).norm() );
DenseMatrix<T> Be = B*e;
for( int iter = 0; iter < maxEigIter; iter++ )
{
x = B*x;
backsolvePositiveDefinite( L, x, x );
x -= dot( x, Be ).conj()*e;
x /= sqrt( dot( x, B*x ).norm() );
}
int t1 = clock();
cout << "[eig] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[eig] max residual: " << residual( A, B, x ) << "\n";
}
template <class T>
void smallestEigPositiveDefinite( SparseMatrix<T>& A,
SparseMatrix<T>& B,
DenseMatrix<T>& E,
DenseMatrix<T>& x )
// solves A x = lambda (B - EE^T) x for the smallest nonzero eigenvalue lambda
// A must be positive (semi-)definite, B must be symmetric; EE^T is a low-rank matrix, and
// x is used as an initial guess
{
int iter;
int t0 = clock();
DenseMatrix<T> ET = E.transpose();
SparseFactor<T> L;
L.build( A );
for( iter = 0; iter < maxEigIter; iter++ )
{
x = B*x - E*(ET*x);
backsolvePositiveDefinite( L, x, x );
x.normalize();
}
int t1 = clock();
cout << "[eig] time: " << seconds( t0, t1 ) << "s" << "\n";
cout << "[eig] max residual: " << residual( A, B, E, x ) << "\n";
}
template <class T>
double residual( const SparseMatrix<T>& A,
const DenseMatrix<T>& x,
const DenseMatrix<T>& b )
// returns the max residual of the linear problem A x = b relative to the largest entry of the solution
{
return ( A*x - b ).norm() / b.norm();
}
template <class T>
double residual( const SparseMatrix<T>& A,
const DenseMatrix<T>& x )
// returns the max residual of the eigenvalue problem A x = lambda x relative to the largest entry of the solution
{
T lambda = rayleighQuotient( A, x );
return (A*x-lambda*x).norm() / x.norm();
}
template <class T>
double residual( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& x )
// returns the max residual of the generalized eigenvalue problem A x = lambda x relative to the largest entry of the solution
{
T lambda = rayleighQuotient( A, B, x );
return (A*x-lambda*(B*x)).norm() / x.norm();
}
template <class T>
double residual( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& E,
const DenseMatrix<T>& x )
// returns the max residual of the generalized eigenvalue problem A x = lambda (B - EE^T) x relative to the largest entry of the solution
{
T lambda = rayleighQuotient( A, B, E, x );
return (A*x-lambda*(B*x-E*(E.transpose()*x))).norm() / x.norm();
}
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const DenseMatrix<T>& x )
// returns <x,Ax>/<x,x>
{
return (x.transpose()*(A*x))(0) * (x.transpose()*x)(0).inv();
}
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& x )
// returns <Ax,x>/<Bx,x>
{
return (x.transpose()*(A*x))(0) * (x.transpose()*(B*x))(0).inv();
}
template <class T>
T rayleighQuotient( const SparseMatrix<T>& A,
const SparseMatrix<T>& B,
const DenseMatrix<T>& E,
const DenseMatrix<T>& x )
// returns <Ax,x>/<(B-EE^T)x,x>
{
return (x.transpose()*(A*x))(0) * (x.transpose()*(B*x-E*(E.transpose()*x)))(0).inv();
}
template <class T>
std::ostream& operator<<( std::ostream& os, const SparseMatrix<T>& o)
{
os.precision( 3 );
for( typename SparseMatrix<T>::const_iterator e = o.begin();
e != o.end();
e ++ )
{
int row = e->first.second;
int col = e->first.first;
os << "( " << row << ", " << col << " ): " << e->second << "\n";
}
return os;
}
template <class T>
SparseFactor<T> :: SparseFactor( void )
: L( NULL )
{}
template <class T>
SparseFactor<T> :: ~SparseFactor( void )
{
if( L )
{
cholmod_l_free_factor( &L, context );
}
}
template <class T>
void SparseFactor<T> :: build( SparseMatrix<T>& A )
{
if( L )
{
cholmod_l_free_factor( &L, context );
L = NULL;
}
int t0, t1;
cholmod_sparse* Ac = A.to_cholmod();
Ac->stype = 1;
t0 = clock();
L = cholmod_l_analyze( Ac, context );
t1 = clock();
cerr << "analyze: " << seconds(t0,t1) << "s" << endl;
t0 = clock();
cholmod_l_factorize( Ac, L, context );
t1 = clock();
cerr << "factorize: " << seconds(t0,t1) << "s" << endl;
}
template <class T>
bool SparseFactor<T> :: valid( void ) const
{
if( L == NULL )
{
return false;
}
return true;
}
template <class T>
cholmod_factor* SparseFactor<T> :: to_cholmod( void )
{
return L;
}
}
================================================
FILE: BaseCode/src/Variable.cpp
================================================
#include "Variable.h"
namespace DDG
{
Variable :: Variable( double value_,
bool fixed_ )
// initialize a variable which has value zero and is not fixed by default
: value( value_ ),
fixed( fixed_ )
{}
Variable :: Variable( std::string name_,
double value_,
bool fixed_ )
// initialize a named variable which has value zero and is not fixed by default
: name( name_ ),
value( value_ ),
fixed( fixed_ )
{}
double& Variable :: operator*( void )
// returns a reference to the numerical value
{
return value;
}
const double& Variable :: operator*( void ) const
// returns a const reference to the numerical value
{
return value;
}
}
================================================
FILE: BaseCode/src/Vector.cpp
================================================
#include <math.h>
#include "Vector.h"
namespace DDG
{
Vector :: Vector( void )
: x( 0. ),
y( 0. ),
z( 0. )
{}
Vector :: Vector( double x0,
double y0,
double z0 )
: x( x0 ),
y( y0 ),
z( z0 )
{}
Vector :: Vector( const Vector& v )
: x( v.x ),
y( v.y ),
z( v.z )
{}
double& Vector :: operator[]( const int& index )
{
return ( &x )[ index ];
}
const double& Vector :: operator[]( const int& index ) const
{
return ( &x )[ index ];
}
Vector Vector :: operator+( const Vector& v ) const
{
return Vector( x + v.x,
y + v.y,
z + v.z );
}
Vector Vector :: operator-( const Vector& v ) const
{
return Vector( x - v.x,
y - v.y,
z - v.z );
}
Vector Vector :: operator-( void ) const
{
return Vector( -x,
-y,
-z );
}
Vector Vector :: operator*( const double& c ) const
{
return Vector( x*c,
y*c,
z*c );
}
Vector operator*( const double& c, const Vector& v )
{
return v*c;
}
Vector Vector :: operator/( const double& c ) const
{
return (*this) * ( 1./c );
}
void Vector :: operator+=( const Vector& v )
{
x += v.x;
y += v.y;
z += v.z;
}
void Vector :: operator-=( const Vector& v )
{
x -= v.x;
y -= v.y;
z -= v.z;
}
void Vector :: operator*=( const double& c )
{
x *= c;
y *= c;
z *= c;
}
void Vector :: operator/=( const double& c )
{
(*this) *= ( 1./c );
}
double Vector :: norm( void ) const
{
return sqrt( norm2());
}
double Vector :: norm2( void ) const
{
return dot( *this, *this );
}
void Vector :: normalize( void )
{
(*this) /= norm();
}
Vector Vector :: unit( void ) const
{
return (*this) / norm();
}
Vector Vector :: abs( void ) const
{
return Vector( fabs( x ),
fabs( y ),
fabs( z ) );
}
double dot( const Vector& u, const Vector& v )
{
return u.x*v.x +
u.y*v.y +
u.z*v.z ;
}
Vector cross( const Vector& u, const Vector& v )
{
return Vector( u.y*v.z - u.z*v.y,
u.z*v.x - u.x*v.z,
u.x*v.y - u.y*v.x );
}
std::ostream& operator << (std::ostream& os, const Vector& o)
{
os << "[ "
<< o.x << " "
<< o.y << " "
<< o.z
<< " ]";
return os;
}
}
================================================
FILE: BaseCode/src/Vertex.cpp
================================================
#include <vector>
using namespace std;
#include "Vertex.h"
#include "Mesh.h"
#include "HalfEdge.h"
namespace DDG
{
double Vertex::area( void ) const
// returns the dual area associated with this vertex
{
double A = 0.;
HalfEdgeCIter h = he;
do
{
if (not h->onBoundary) A += h->face->area();
h = h->flip->next;
}
while( h != he );
return A / 3.;
}
Vector Vertex::normal( void ) const
// returns the vertex normal
{
Vector N;
HalfEdgeCIter h = he;
do
{
if (not h->onBoundary) N += h->face->normal();
h = h->flip->next;
}
while( h != he );
return N.unit();
}
vector<HalfEdge> isolated; // all isolated vertices point to isolated.begin()
bool Vertex::isIsolated( void ) const
// returns true if the vertex is not contained in any face or edge; false otherwise
{
return he == isolated.begin();
}
int Vertex :: valence( void ) const
// returns the number of incident faces
{
int n = 0;
HalfEdgeCIter h = he;
do
{
n++;
h = h->flip->next;
}
while( h != he );
return n;
}
void Vertex :: toggleTag()
{
tag = !tag;
}
}
================================================
FILE: BaseCode/src/Viewer.cpp
================================================
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
#include "Viewer.h"
#include "Image.h"
#include "Application.h"
namespace DDG
{
// declare static member variables
Mesh Viewer::mesh;
GLuint Viewer::surfaceDL = 0;
int Viewer::windowSize[2] = { 512, 512 };
Camera Viewer::camera;
Shader Viewer::shader;
bool Viewer::renderWireframe = false;
void Viewer :: init( void )
{
restoreViewerState();
initGLUT();
setGL();
initGLSL();
updateDisplayList();
glutMainLoop();
}
void Viewer :: initGLUT( void )
{
int argc = 0;
vector< vector<char> > argv(1);
// initialize window
glutInitWindowSize( windowSize[0], windowSize[1] );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInit( &argc, (char**)&argv );
glutCreateWindow( "DDG" );
// specify callbacks
glutDisplayFunc ( Viewer::display );
glutIdleFunc ( Viewer::idle );
glutKeyboardFunc ( Viewer::keyboard );
glutSpecialFunc ( Viewer::special );
glutMouseFunc ( Viewer::mouse );
glutMotionFunc ( Viewer::motion );
// initialize menus
int viewMenu = glutCreateMenu( Viewer::view );
glutSetMenu( viewMenu );
glutAddMenuEntry( "[f] Wireframe", menuWireframe );
glutAddMenuEntry( "[↑] Zoom In", menuZoomIn );
glutAddMenuEntry( "[↓] Zoom Out", menuZoomOut );
int mainMenu = glutCreateMenu( Viewer::menu );
glutSetMenu( mainMenu );
glutAddMenuEntry( "[space] Process Mesh", menuProcess );
glutAddMenuEntry( "[r] Reset Mesh", menuResetMesh );
glutAddMenuEntry( "[w] Write Mesh", menuWriteMesh );
glutAddMenuEntry( "[\\] Screenshot", menuScreenshot );
glutAddMenuEntry( "[esc] Exit", menuExit );
glutAddSubMenu( "View", viewMenu );
glutAttachMenu( GLUT_RIGHT_BUTTON );
}
void Viewer :: initGLSL( void )
{
shader.loadVertex( "shaders/vertex.glsl" );
shader.loadFragment( "shaders/fragment.glsl" );
}
void Viewer :: menu( int value )
{
switch( value )
{
case( menuProcess ):
mProcess();
break;
case( menuResetMesh ):
mResetMesh();
break;
case( menuWriteMesh ):
mWriteMesh();
break;
case( menuScreenshot ):
mScreenshot();
break;
case( menuExit ):
mExit();
break;
default:
break;
}
}
void Viewer :: view( int value )
{
switch( value )
{
case( menuWireframe ):
mWireframe();
break;
case( menuZoomIn ):
mZoomIn();
break;
case( menuZoomOut ):
mZoomOut();
break;
default:
break;
}
}
void Viewer :: keyboard( unsigned char c, int x, int y )
{
switch( c )
{
case 'f':
mWireframe();
break;
case 'w':
mWriteMesh();
break;
case 'r':
mResetMesh();
break;
case '\\':
mScreenshot();
break;
case ' ':
mProcess();
break;
case 27:
mExit();
break;
default:
break;
}
}
void Viewer :: special( int i, int x, int y )
{
switch( i )
{
case GLUT_KEY_UP:
camera.zoomIn();
break;
case GLUT_KEY_DOWN:
camera.zoomOut();
break;
case 27:
mExit();
break;
default:
break;
}
}
void Viewer :: mouse( int button, int state, int x, int y )
{
if( ( glutGetModifiers() & GLUT_ACTIVE_SHIFT) and state == GLUT_UP )
pickVertex(x, y);
else
camera.mouse( button, state, x, y );
}
void Viewer :: motion( int x, int y )
{
camera.motion( x, y );
}
void Viewer :: idle( void )
{
camera.idle();
glutPostRedisplay();
}
void Viewer :: storeViewerState( void )
{
ofstream out( ".viewer_state.txt" );
out << camera.rLast[0] << endl;
out << camera.rLast[1] << endl;
out << camera.rLast[2] << endl;
out << camera.rLast[3] << endl;
GLint view[4];
glGetIntegerv( GL_VIEWPORT, view );
out << view[2] << endl;
out << view[3] << endl;
}
void Viewer :: restoreViewerState( void )
{
ifstream in( ".viewer_state.txt" );
if( !in.is_open() ) return;
in >> camera.rLast[0];
in >> camera.rLast[1];
in >> camera.rLast[2];
in >> camera.rLast[3];
in >> windowSize[0];
in >> windowSize[1];
}
void Viewer :: mProcess( void )
{
// TODO: call Application here!
updateDisplayList();
}
void Viewer :: mResetMesh( void )
{
mesh.reload();
updateDisplayList();
}
void Viewer :: mWriteMesh( void )
{
mesh.write( "out.obj" );
}
void Viewer :: mExit( void )
{
storeViewerState();
exit( 0 );
}
void Viewer :: mWireframe( void )
{
renderWireframe = !renderWireframe;
updateDisplayList();
}
void Viewer :: mZoomIn( void )
{
camera.zoomIn();
}
void Viewer :: mZoomOut( void )
{
camera.zoomOut();
}
void Viewer :: mScreenshot( void )
{
static int index = 0;
// get window width and height
GLint view[4];
glGetIntegerv( GL_VIEWPORT, view );
int w = view[2];
int h = view[3];
// get pixels
Image image( w, h );
glReadPixels( 0, 0, w, h, GL_BGR, GL_FLOAT, &image(0,0) );
stringstream filename;
filename << "frames/viewer" << setw(8) << setfill( '0' ) << index << ".tga";
image.write( filename.str().c_str() );
index++;
}
void Viewer :: display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
shader.enable();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
double aspect = (double) viewport[2] / (double) viewport[3];
const double fovy = 50.;
const double clipNear = .01;
const double clipFar = 1000.;
gluPerspective( fovy, aspect, clipNear, clipFar );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
Quaternion eye = Vector( 0., 0., -2.5*camera.zoom );
Quaternion center = Vector( 0., 0., 0. );
Quaternion up = Vector( 0., 1., 0. );
gluLookAt( eye[1], eye[2], eye[3],
center[1], center[2], center[3],
up[1], up[2], up[3] );
Quaternion r = camera.currentRotation();
eye = r.conj() * eye * r;
GLint uniformEye = glGetUniformLocation( shader, "eye" );
glUniform3f( uniformEye, eye[1], eye[2], eye[3] );
Quaternion light = Vector( -1., 1., -2. );
light = r.conj() * light * r;
GLint uniformLight = glGetUniformLocation( shader, "light" );
glUniform3f( uniformLight, light[1], light[2], light[3] );
camera.setView();
callDisplayList();
shader.disable();
glutSwapBuffers();
}
void Viewer :: updateDisplayList( void )
{
if( surfaceDL )
{
glDeleteLists( surfaceDL, 1 );
surfaceDL = 0;
}
surfaceDL = glGenLists( 1 );
glNewList( surfaceDL, GL_COMPILE );
setMeshMaterial();
drawScene();
glEndList();
}
void Viewer :: setGL( void )
{
glClearColor( .5, .5, .5, 1. );
setLighting();
}
void Viewer :: setLighting( void )
{
GLfloat position[4] = { 20., 30., 40., 0. };
glLightfv( GL_LIGHT0, GL_POSITION, position );
glEnable( GL_LIGHT0 );
glEnable( GL_NORMALIZE );
}
void Viewer :: setMeshMaterial( void )
{
GLfloat diffuse[4] = { .8, .5, .3, 1. };
GLfloat specular[4] = { .3, .3, .3, 1. };
GLfloat ambient[4] = { .2, .2, .5, 1. };
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse );
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, specular );
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, ambient );
glMaterialf ( GL_FRONT_AND_BACK, GL_SHININESS, 16. );
}
void Viewer :: callDisplayList( void )
{
glPushAttrib( GL_ALL_ATTRIB_BITS );
glEnable( GL_DEPTH_TEST );
glEnable( GL_LIGHTING );
glCallList( surfaceDL );
glPopAttrib();
}
void Viewer :: drawScene( void )
{
glPushAttrib( GL_ALL_ATTRIB_BITS );
glEnable( GL_COLOR_MATERIAL );
glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 1., 1. );
glColor3d( 1., .5, .25 );
drawPolygons();
glDisable( GL_POLYGON_OFFSET_FILL );
glDisable( GL_COLOR_MATERIAL );
if( renderWireframe ) drawWireframe();
drawIsolatedVertices();
drawSelectedVertices();
glPopAttrib();
}
void Viewer :: drawPolygons( void )
{
for( FaceCIter f = mesh.faces.begin();
f != mesh.faces.end();
f ++ )
{
if( f->isBoundary() ) continue;
glBegin( GL_POLYGON );
if( renderWireframe )
{
Vector N = f->normal();
glNormal3dv( &N[0] );
}
HalfEdgeCIter he = f->he;
do
{
if( not renderWireframe )
{
Vector N = he->vertex->normal();
glNormal3dv( &N[0] );
}
glVertex3dv( &he->vertex->position[0] );
he = he->next;
}
while( he != f->he );
glEnd();
}
}
void Viewer :: drawWireframe( void )
{
shader.disable();
glPushAttrib( GL_ALL_ATTRIB_BITS );
glDisable( GL_LIGHTING );
glColor4f( 0., 0., 0., 0.5 );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glBegin( GL_LINES );
for( EdgeCIter e = mesh.edges.begin();
e != mesh.edges.end();
e ++ )
{
glVertex3dv( &e->he->vertex->position[0] );
glVertex3dv( &e->he->flip->vertex->position[0] );
}
glEnd();
glPopAttrib();
}
void Viewer :: drawIsolatedVertices( void )
{
glPushAttrib( GL_ALL_ATTRIB_BITS );
glPointSize( 5 );
glHint( GL_POINT_SMOOTH_HINT, GL_NICEST );
glEnable( GL_POINT_SMOOTH );
glColor3f( 1., 0., 0. );
glBegin( GL_POINTS );
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
if( v->isIsolated() )
{
glVertex3dv( &v->position[0] );
}
}
glEnd();
glPopAttrib();
}
void Viewer :: drawVertices( void )
{
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
glLoadName(v->index);
glBegin(GL_POINTS);
glVertex3dv( &v->position[0] );
glEnd();
}
}
void Viewer :: drawSelectedVertices( void )
{
glPushAttrib( GL_ALL_ATTRIB_BITS );
glEnable( GL_COLOR_MATERIAL );
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glColor3f( 0., 0.5, 0.5 );
double h = 0.75*mesh.meanEdgeLength();
for( VertexCIter v = mesh.vertices.begin();
v != mesh.vertices.end();
v ++ )
{
if( v->tag )
{
glPushMatrix();
glTranslated(v->position.x, v->position.y, v->position.z);
glutSolidSphere(h, 10, 10);
glPopMatrix();
}
}
glEnd();
glPopAttrib();
}
void Viewer :: pickVertex(int x, int y)
{
int width = glutGet(GLUT_WINDOW_WIDTH );
int height = glutGet(GLUT_WINDOW_HEIGHT);
if( x < 0 || x >= width || y < 0 || y >= height ) return;
int bufSize = mesh.vertices.size();
GLuint* buf = new GLuint[bufSize];
glSelectBuffer(bufSize, buf);
GLint viewport[4];
GLdouble projection[16];
glGetIntegerv( GL_VIEWPORT, viewport );
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(x, viewport[3]-y, 10, 10, viewport);
glMultMatrixd(projection);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
drawVertices();
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
long hits = glRenderMode(GL_RENDER);
int index = -1;
double min_z = 1.0e100;
for( long i = 0; i < hits; ++i )
{
double distance = buf[4*i + 1];
if( distance < min_z )
{
index = buf[4*i + 3];
min_z = distance;
}
}
delete[] buf;
if (index >= 0)
{
mesh.vertices[index].toggleTag();
updateDisplayList();
}
}
}
================================================
FILE: BaseCode/src/main.cpp
================================================
#include <iostream>
using namespace std;
#include "Viewer.h"
#include "DenseMatrix.h"
using namespace DDG;
int main( int argc, char** argv )
{
if( argc != 2 )
{
cerr << "usage: " << argv[0] << " in.obj" << endl;
return 1;
}
Viewer viewer;
viewer.mesh.read( argv[1] );
viewer.init();
return 0;
}
================================================
FILE: Connection/Makefile
================================================
##########################################################################################
# Specify library locations here (add or remove "#" marks to comment/uncomment lines for your platform)
# Mac OS X
DDG_INCLUDE_PATH =
DDG_LIBRARY_PATH =
DDG_BLAS_LIBS = -framework Accelerate
DDG_SUITESPARSE_LIBS = -lspqr -lumfpack -lcholmod -lmetis -lcolamd -lccolamd -lcamd -lamd -ltbb -lm -lsuitesparseconfig
DDG_OPENGL_LIBS = -framework OpenGL -framework GLUT
# # Linux
# DDG_INCLUDE_PATH =
# DDG_LIBRARY_PATH =
# DDG_BLAS_LIBS = -llapack -lblas -lgfortran
# DDG_SUITESPARSE_LIBS = -lspqr -lcholmod -lmetis -lcolamd -lccolamd -lcamd -lamd -lm
# DDG_OPENGL_LIBS = -lglut -lGL -lGLU -lX11
# # Windows / Cygwin
# DDG_INCLUDE_PATH = -I/usr/include/opengl -I/usr/include/suitesparse
# DDG_LIBRARY_PATH = -L/usr/lib/w32api -L/usr/lib/suitesparse
# DDG_BLAS_LIBS = -llapack -lblas
# DDG_SUITESPARSE_LIBS = -lspqr -lcholmod -lcolamd -lccolamd -lcamd -lamd -lm
# DDG_OPENGL_LIBS = -lglut32 -lglu32 -lopengl32
########################################################################################
TARGET = connection
CC = g++
LD = g++
CFLAGS = -O3 -Wall -Werror -ansi -pedantic $(DDG_INCLUDE_PATH) -I./include -I./src
LFLAGS = -O3 -Wall -Werror -ansi -pedantic $(DDG_LIBRARY_PATH)
LIBS = $(DDG_OPENGL_LIBS) $(DDG_SUITESPARSE_LIBS) $(DDG_BLAS_LIBS)
########################################################################################
## !! Do not edit below this line
HEADERS := $(wildcard include/*.h)
SOURCES := $(wildcard src/*.cpp)
OBJECTS := $(addprefix obj/,$(notdir $(SOURCES:.cpp=.o)))
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(LD) $(OBJECTS) -o $(TARGET) $(CFLAGS) $(LFLAGS) $(LIBS)
obj/%.o: src/%.cpp ${HEADERS}
$(CC) -c $< -o $@ $(CFLAGS)
clean:
rm -f $(OBJECTS)
rm -f $(TARGET)
rm -f $(TARGET).exe
================================================
FILE: Connection/include/Application.h
================================================
/*
* Trivial Connections on Discrete Surfaces
* Keenan Crane, Mathieu Desbun and Peter Schroeder
* SGP 2010 / Computer Graphics Forum
*
* A Simplified Algorithm for Simply-Connected Surfaces
* Fernando de Goes and Keenan Crane
*
* TODO: add soft and hard directional constraints
*/
#ifndef DDG_APPLICATION_H
#define DDG_APPLICATION_H
#include "Mesh.h"
#include "Real.h"
#include "Quaternion.h"
#include "DenseMatrix.h"
#include "SparseMatrix.h"
#include "DiscreteExteriorCalculus.h"
#include "Utility.h"
namespace DDG
{
class Application
{
public:
bool solveForConneciton(Mesh& mesh)
{
bool ok = checkGaussBonnet(mesh);
if( not ok )
{
std::cout << "Gauss-Bonnet thm does not hold" << std::endl;
return false;
}
int t0 = clock();
solveForTrivialHolonomy(mesh);
int t1 = clock();
cout << "[trivial] time: " << seconds( t0, t1 ) <
gitextract_rojb_la7/
├── .gitignore
├── BaseCode/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Connection/
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── Direction.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── HarmonicBases.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── TreeCotree.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Elasticity/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── .Elasticity.h.swo
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── PolarDecomposition2x2.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Fairing/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── Flatten/
│ ├── .viewer_state.txt
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ ├── main.cpp
│ └── qcError.cpp
├── Geodesics/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
├── HOWTO
├── Hot2/
│ ├── .viewer_state.txt
│ ├── Makefile
│ ├── include/
│ │ ├── Application.h
│ │ ├── Camera.h
│ │ ├── Complex.h
│ │ ├── DenseMatrix.h
│ │ ├── DiscreteExteriorCalculus.h
│ │ ├── Edge.h
│ │ ├── Face.h
│ │ ├── HalfEdge.h
│ │ ├── Image.h
│ │ ├── LinearContext.h
│ │ ├── LinearEquation.h
│ │ ├── LinearPolynomial.h
│ │ ├── LinearSystem.h
│ │ ├── Mesh.h
│ │ ├── MeshIO.h
│ │ ├── Quaternion.h
│ │ ├── Real.h
│ │ ├── Shader.h
│ │ ├── SparseMatrix.h
│ │ ├── Types.h
│ │ ├── Utility.h
│ │ ├── Variable.h
│ │ ├── Vector.h
│ │ ├── Vertex.h
│ │ └── Viewer.h
│ ├── obj/
│ │ └── .empty
│ ├── shaders/
│ │ ├── fragment.glsl
│ │ └── vertex.glsl
│ └── src/
│ ├── Camera.cpp
│ ├── Complex.cpp
│ ├── DenseMatrix.cpp
│ ├── DenseMatrix.inl
│ ├── DiscreteExteriorCalculus.inl
│ ├── Edge.cpp
│ ├── Face.cpp
│ ├── HalfEdge.cpp
│ ├── Image.cpp
│ ├── LinearContext.cpp
│ ├── LinearEquation.cpp
│ ├── LinearPolynomial.cpp
│ ├── LinearSystem.cpp
│ ├── Mesh.cpp
│ ├── MeshIO.cpp
│ ├── Quaternion.cpp
│ ├── Real.cpp
│ ├── Shader.cpp
│ ├── SparseMatrix.cpp
│ ├── SparseMatrix.inl
│ ├── Variable.cpp
│ ├── Vector.cpp
│ ├── Vertex.cpp
│ ├── Viewer.cpp
│ └── main.cpp
└── Slides/
├── apps-siggraph2013.key
└── theory-siggraph2013.key
SYMBOL INDEX (1044 symbols across 334 files)
FILE: BaseCode/include/Application.h
function namespace (line 4) | namespace DDG
FILE: BaseCode/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: BaseCode/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: BaseCode/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: BaseCode/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: BaseCode/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: BaseCode/include/Face.h
function namespace (line 15) | namespace DDG
FILE: BaseCode/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: BaseCode/include/Image.h
function namespace (line 19) | namespace DDG
FILE: BaseCode/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: BaseCode/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: BaseCode/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: BaseCode/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: BaseCode/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: BaseCode/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: BaseCode/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: BaseCode/include/Real.h
function namespace (line 4) | namespace DDG
FILE: BaseCode/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: BaseCode/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: BaseCode/include/Types.h
function namespace (line 16) | namespace DDG
FILE: BaseCode/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: BaseCode/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: BaseCode/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: BaseCode/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: BaseCode/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: BaseCode/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: BaseCode/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: BaseCode/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: BaseCode/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: BaseCode/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: BaseCode/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: BaseCode/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: BaseCode/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: BaseCode/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: BaseCode/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: BaseCode/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: BaseCode/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: BaseCode/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: BaseCode/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: BaseCode/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: BaseCode/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: BaseCode/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: BaseCode/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: BaseCode/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: BaseCode/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: BaseCode/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: BaseCode/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Connection/include/Application.h
function namespace (line 23) | namespace DDG
FILE: Connection/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Connection/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Connection/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Connection/include/Direction.h
function namespace (line 7) | namespace DDG
FILE: Connection/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Connection/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Connection/include/Face.h
function namespace (line 16) | namespace DDG
FILE: Connection/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Connection/include/HarmonicBases.h
function namespace (line 10) | namespace DDG
FILE: Connection/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Connection/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Connection/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Connection/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Connection/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Connection/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Connection/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Connection/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Connection/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Connection/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Connection/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Connection/include/TreeCotree.h
function namespace (line 7) | namespace DDG
FILE: Connection/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Connection/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Connection/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Connection/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Connection/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Connection/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Connection/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Connection/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Connection/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Connection/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: Connection/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: Connection/src/HalfEdge.cpp
type DDG (line 6) | namespace DDG
function Vector (line 22) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Connection/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Connection/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Connection/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Connection/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Connection/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Connection/src/Mesh.cpp
type DDG (line 13) | namespace DDG
class HalfEdgeIterCompare (line 25) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 26) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 27) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 28) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 29) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 30) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 31) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 32) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 34) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Connection/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Connection/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Connection/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Connection/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Connection/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Connection/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Connection/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Connection/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Connection/src/Viewer.cpp
type DDG (line 17) | namespace DDG
FILE: Connection/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Elasticity/include/Application.h
function namespace (line 20) | namespace DDG
function computeLaplacian (line 128) | void computeLaplacian(const Mesh& mesh,
function computeDivergence (line 143) | void computeDivergence(const Mesh& mesh,
function assign2DPositions (line 171) | void assign2DPositions(const DenseMatrix<Complex>& x, Mesh& mesh)
function get2DPositions (line 182) | void get2DPositions(const Mesh& mesh, DenseMatrix<Complex>& x) const
FILE: Elasticity/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Elasticity/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Elasticity/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Elasticity/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Elasticity/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Elasticity/include/Face.h
function namespace (line 15) | namespace DDG
FILE: Elasticity/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Elasticity/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Elasticity/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Elasticity/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Elasticity/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Elasticity/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Elasticity/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Elasticity/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Elasticity/include/PolarDecomposition2x2.h
function namespace (line 7) | namespace DDG
FILE: Elasticity/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Elasticity/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Elasticity/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Elasticity/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Elasticity/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Elasticity/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Elasticity/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Elasticity/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Elasticity/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Elasticity/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Elasticity/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Elasticity/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Elasticity/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Elasticity/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: Elasticity/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: Elasticity/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Elasticity/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Elasticity/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Elasticity/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Elasticity/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Elasticity/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Elasticity/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Elasticity/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Elasticity/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Elasticity/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Elasticity/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Elasticity/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Elasticity/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Elasticity/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Elasticity/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Elasticity/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: Elasticity/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Fairing/include/Application.h
function namespace (line 16) | namespace DDG
FILE: Fairing/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Fairing/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Fairing/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Fairing/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Fairing/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Fairing/include/Face.h
function namespace (line 15) | namespace DDG
FILE: Fairing/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Fairing/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Fairing/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Fairing/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Fairing/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Fairing/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Fairing/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Fairing/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Fairing/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Fairing/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Fairing/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Fairing/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Fairing/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Fairing/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Fairing/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Fairing/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Fairing/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Fairing/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Fairing/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Fairing/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Fairing/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Fairing/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: Fairing/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: Fairing/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Fairing/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Fairing/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Fairing/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Fairing/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Fairing/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Fairing/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Fairing/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Fairing/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Fairing/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Fairing/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Fairing/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Fairing/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Fairing/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Fairing/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Fairing/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: Fairing/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Flatten/include/Application.h
function namespace (line 16) | namespace DDG
FILE: Flatten/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Flatten/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Flatten/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Flatten/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Flatten/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Flatten/include/Face.h
function namespace (line 15) | namespace DDG
FILE: Flatten/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Flatten/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Flatten/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Flatten/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Flatten/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Flatten/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Flatten/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Flatten/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Flatten/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Flatten/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Flatten/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Flatten/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Flatten/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Flatten/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Flatten/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Flatten/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Flatten/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Flatten/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Flatten/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Flatten/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Flatten/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Flatten/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: Flatten/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: Flatten/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Flatten/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Flatten/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Flatten/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Flatten/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Flatten/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Flatten/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Flatten/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Flatten/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Flatten/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Flatten/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Flatten/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Flatten/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Flatten/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Flatten/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Flatten/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: Flatten/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Flatten/src/qcError.cpp
type DDG (line 13) | namespace DDG
function Vector (line 15) | Vector HSV(double h, double s, double v)
function Vector (line 82) | Vector qcColor( double qc )
function quasiConformalDistortion (line 92) | double quasiConformalDistortion( Vector p1, Vector p2, Vector p3,
function faceQCDistortion (line 140) | double faceQCDistortion( FaceCIter f )
FILE: Geodesics/include/Application.h
function namespace (line 19) | namespace DDG
FILE: Geodesics/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Geodesics/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Geodesics/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Geodesics/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Geodesics/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Geodesics/include/Face.h
function namespace (line 16) | namespace DDG
FILE: Geodesics/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Geodesics/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Geodesics/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Geodesics/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Geodesics/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Geodesics/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Geodesics/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Geodesics/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Geodesics/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Geodesics/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Geodesics/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Geodesics/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Geodesics/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Geodesics/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Geodesics/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Geodesics/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Geodesics/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Geodesics/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Geodesics/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Geodesics/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Geodesics/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Geodesics/src/Edge.cpp
type DDG (line 4) | namespace DDG
FILE: Geodesics/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
FILE: Geodesics/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Geodesics/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Geodesics/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Geodesics/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Geodesics/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Geodesics/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Geodesics/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Geodesics/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Geodesics/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Geodesics/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Geodesics/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Geodesics/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Geodesics/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Geodesics/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Geodesics/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Geodesics/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: Geodesics/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
FILE: Hot2/include/Application.h
function namespace (line 15) | namespace DDG
FILE: Hot2/include/Camera.h
function namespace (line 24) | namespace DDG
FILE: Hot2/include/Complex.h
function namespace (line 6) | namespace DDG
FILE: Hot2/include/DenseMatrix.h
function namespace (line 38) | namespace DDG
FILE: Hot2/include/DiscreteExteriorCalculus.h
function namespace (line 26) | namespace DDG
FILE: Hot2/include/Edge.h
function namespace (line 15) | namespace DDG
FILE: Hot2/include/Face.h
function namespace (line 15) | namespace DDG
FILE: Hot2/include/HalfEdge.h
function namespace (line 15) | namespace DDG
FILE: Hot2/include/Image.h
function namespace (line 19) | namespace DDG
FILE: Hot2/include/LinearContext.h
function namespace (line 18) | namespace DDG
FILE: Hot2/include/LinearEquation.h
function namespace (line 21) | namespace DDG
FILE: Hot2/include/LinearPolynomial.h
function namespace (line 28) | namespace DDG
FILE: Hot2/include/LinearSystem.h
function namespace (line 35) | namespace DDG
FILE: Hot2/include/Mesh.h
function namespace (line 54) | namespace DDG
FILE: Hot2/include/MeshIO.h
function namespace (line 21) | namespace DDG
FILE: Hot2/include/Quaternion.h
function namespace (line 40) | namespace DDG
FILE: Hot2/include/Real.h
function namespace (line 4) | namespace DDG
FILE: Hot2/include/Shader.h
function namespace (line 27) | namespace DDG
FILE: Hot2/include/SparseMatrix.h
function namespace (line 42) | namespace DDG
FILE: Hot2/include/Types.h
function namespace (line 16) | namespace DDG
FILE: Hot2/include/Utility.h
function namespace (line 8) | namespace DDG
function namespace (line 28) | namespace DDGConstants
FILE: Hot2/include/Variable.h
function namespace (line 44) | namespace DDG
FILE: Hot2/include/Vector.h
function namespace (line 40) | namespace DDG
FILE: Hot2/include/Vertex.h
function namespace (line 16) | namespace DDG
FILE: Hot2/include/Viewer.h
function namespace (line 18) | namespace DDG
FILE: Hot2/src/Camera.cpp
type DDG (line 8) | namespace DDG
function Quaternion (line 19) | Quaternion Camera :: clickToSphere( int x, int y )
function Quaternion (line 44) | Quaternion Camera :: currentRotation( void ) const
FILE: Hot2/src/Complex.cpp
type DDG (line 7) | namespace DDG
function Complex (line 60) | Complex Complex::operator-( void ) const
function Complex (line 65) | Complex Complex::conj( void ) const
function Complex (line 71) | Complex Complex::inv( void ) const
function Complex (line 95) | Complex Complex::unit( void ) const
function Complex (line 101) | Complex Complex::exponential( void ) const
function Complex (line 107) | Complex operator+( const Complex& z1, const Complex& z2 )
function Complex (line 115) | Complex operator-( const Complex& z1, const Complex& z2 )
function Complex (line 123) | Complex operator*( const Complex& z1, const Complex& z2 )
function Complex (line 131) | Complex operator*( const Complex& z, double r )
function Complex (line 139) | Complex operator*( double r, const Complex& z )
function Complex (line 145) | Complex operator/( const Complex& z, double r )
function Complex (line 153) | Complex operator/( const Complex& z1, const Complex& z2 )
function dot (line 161) | double dot( const Complex& z1, const Complex& z2 )
function cross (line 166) | double cross( const Complex& z1, const Complex& z2 )
FILE: Hot2/src/DenseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_dense (line 6) | cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )
function cholmod_dense (line 28) | cholmod_dense* DenseMatrix<Complex> :: to_cholmod( void )
function cholmod_dense (line 51) | cholmod_dense* DenseMatrix<Quaternion> :: to_cholmod( void )
FILE: Hot2/src/Edge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 6) | Vector Edge :: dualPoint() const
FILE: Hot2/src/Face.cpp
type DDG (line 5) | namespace DDG
function Vector (line 15) | Vector Face::normal( void ) const
function Vector (line 29) | Vector Face :: circumcenter( void ) const
function Vector (line 38) | Vector Face :: barycenter( void ) const
function Vector (line 46) | Vector Face :: dualPoint( void ) const
FILE: Hot2/src/HalfEdge.cpp
type DDG (line 4) | namespace DDG
function Vector (line 20) | Vector HalfEdge :: rotatedEdge( void ) const
FILE: Hot2/src/Image.cpp
type DDG (line 9) | namespace DDG
class TGAHeader (line 59) | class TGAHeader
FILE: Hot2/src/LinearContext.cpp
type DDG (line 3) | namespace DDG
FILE: Hot2/src/LinearEquation.cpp
type DDG (line 3) | namespace DDG
function LinearEquation (line 5) | LinearEquation operator==( const LinearPolynomial& lhs,
FILE: Hot2/src/LinearPolynomial.cpp
type DDG (line 7) | namespace DDG
function LinearPolynomial (line 23) | const LinearPolynomial& LinearPolynomial :: operator=( double c )
function LinearPolynomial (line 32) | const LinearPolynomial& LinearPolynomial :: operator=( Variable& v )
function LinearPolynomial (line 133) | LinearPolynomial LinearPolynomial::operator-( void ) const
function LinearPolynomial (line 163) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 169) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 175) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 181) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 187) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 193) | LinearPolynomial operator*( Variable& v,
function LinearPolynomial (line 199) | LinearPolynomial operator/( Variable& v,
function LinearPolynomial (line 206) | LinearPolynomial operator+( Variable& v1,
function LinearPolynomial (line 212) | LinearPolynomial operator-( Variable& v1,
function LinearPolynomial (line 219) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 229) | LinearPolynomial operator+( double c,
function LinearPolynomial (line 239) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 249) | LinearPolynomial operator-( double c,
function LinearPolynomial (line 259) | LinearPolynomial operator*( const LinearPolynomial& p,
function LinearPolynomial (line 269) | LinearPolynomial operator*( double c,
function LinearPolynomial (line 279) | LinearPolynomial operator/( const LinearPolynomial& p,
function LinearPolynomial (line 289) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 295) | LinearPolynomial operator+( Variable& v,
function LinearPolynomial (line 301) | LinearPolynomial operator-( const LinearPolynomial& p,
function LinearPolynomial (line 307) | LinearPolynomial operator-( Variable& v,
function LinearPolynomial (line 313) | LinearPolynomial operator+( const LinearPolynomial& p,
function LinearPolynomial (line 323) | LinearPolynomial operator-( const LinearPolynomial& p,
function ostream (line 333) | ostream& operator<<( ostream& os, const LinearPolynomial& p )
FILE: Hot2/src/LinearSystem.cpp
type DDG (line 10) | namespace DDG
FILE: Hot2/src/Mesh.cpp
type DDG (line 9) | namespace DDG
class HalfEdgeIterCompare (line 19) | class HalfEdgeIterCompare { public: bool operator()( const HalfEdgeI...
class HalfEdgeCIterCompare (line 20) | class HalfEdgeCIterCompare { public: bool operator()( const HalfEdgeCI...
class VertexIterCompare (line 21) | class VertexIterCompare { public: bool operator()( const VertexI...
class VertexCIterCompare (line 22) | class VertexCIterCompare { public: bool operator()( const VertexCI...
class FaceIterCompare (line 23) | class FaceIterCompare { public: bool operator()( const FaceI...
class FaceCIterCompare (line 24) | class FaceCIterCompare { public: bool operator()( const FaceCI...
class EdgeIterCompare (line 25) | class EdgeIterCompare { public: bool operator()( const EdgeI...
class EdgeCIterCompare (line 26) | class EdgeCIterCompare { public: bool operator()( const EdgeCI...
function Mesh (line 28) | const Mesh& Mesh :: operator=( const Mesh& mesh )
FILE: Hot2/src/MeshIO.cpp
type DDG (line 11) | namespace DDG
class Index (line 13) | class Index
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
class MeshData (line 39) | class MeshData
function Index (line 412) | Index MeshIO :: parseFaceIndex( const string& token )
method Index (line 16) | Index( void )
method Index (line 19) | Index( int p, int t, int n )
FILE: Hot2/src/Quaternion.cpp
type DDG (line 7) | namespace DDG
function Quaternion (line 56) | const Quaternion& Quaternion :: operator=( double _s )
function Quaternion (line 65) | const Quaternion& Quaternion :: operator=( const Vector& _v )
function Vector (line 110) | Vector& Quaternion::im( void )
function Vector (line 116) | const Vector& Quaternion::im( void ) const
function Quaternion (line 125) | Quaternion Quaternion::operator+( const Quaternion& q ) const
function Quaternion (line 131) | Quaternion Quaternion::operator-( const Quaternion& q ) const
function Quaternion (line 137) | Quaternion Quaternion::operator-( void ) const
function Quaternion (line 143) | Quaternion Quaternion::operator*( double c ) const
function Quaternion (line 149) | Quaternion operator*( double c, const Quaternion& q )
function Quaternion (line 155) | Quaternion Quaternion::operator/( double c ) const
function Quaternion (line 204) | Quaternion Quaternion::operator*( const Quaternion& q ) const
function Quaternion (line 221) | Quaternion Quaternion::conj( void ) const
function Quaternion (line 227) | Quaternion Quaternion::inv( void ) const
function Quaternion (line 247) | Quaternion Quaternion::unit( void ) const
function Quaternion (line 262) | Quaternion slerp( const Quaternion& q0, const Quaternion& q1, double t )
FILE: Hot2/src/Real.cpp
type DDG (line 4) | namespace DDG
function Real (line 41) | Real Real :: conj( void ) const
function Real (line 47) | Real Real :: inv( void ) const
function Real (line 65) | Real Real :: unit( void ) const
FILE: Hot2/src/Shader.cpp
type DDG (line 7) | namespace DDG
FILE: Hot2/src/SparseMatrix.cpp
type DDG (line 3) | namespace DDG
function cholmod_sparse (line 76) | cholmod_sparse* SparseMatrix<Quaternion> :: to_cholmod( void )
function solve (line 146) | void solve( SparseMatrix<Real>& A,
function solve (line 162) | void solve( SparseMatrix<Complex>& A,
function solve (line 178) | void solve( SparseMatrix<Quaternion>& A,
function solveSymmetric (line 194) | void solveSymmetric( SparseMatrix<Complex>& A,
FILE: Hot2/src/Variable.cpp
type DDG (line 3) | namespace DDG
FILE: Hot2/src/Vector.cpp
type DDG (line 5) | namespace DDG
function Vector (line 37) | Vector Vector :: operator+( const Vector& v ) const
function Vector (line 44) | Vector Vector :: operator-( const Vector& v ) const
function Vector (line 51) | Vector Vector :: operator-( void ) const
function Vector (line 58) | Vector Vector :: operator*( const double& c ) const
function Vector (line 65) | Vector operator*( const double& c, const Vector& v )
function Vector (line 70) | Vector Vector :: operator/( const double& c ) const
function Vector (line 116) | Vector Vector :: unit( void ) const
function Vector (line 121) | Vector Vector :: abs( void ) const
function dot (line 128) | double dot( const Vector& u, const Vector& v )
function Vector (line 135) | Vector cross( const Vector& u, const Vector& v )
FILE: Hot2/src/Vertex.cpp
type DDG (line 8) | namespace DDG
function Vector (line 26) | Vector Vertex::normal( void ) const
FILE: Hot2/src/Viewer.cpp
type DDG (line 14) | namespace DDG
FILE: Hot2/src/main.cpp
function main (line 8) | int main( int argc, char** argv )
Condensed preview — 393 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,481K chars).
[
{
"path": ".gitignore",
"chars": 57,
"preview": "\n.DS_Store\n\n*.o\n*.swp\n\nFlatten/Makefile\n\nFlatten/flatten\n"
},
{
"path": "BaseCode/.viewer_state.txt",
"chars": 48,
"preview": "0.126663\n-0.0243652\n-0.989174\n0.0699843\n815\n767\n"
},
{
"path": "BaseCode/Makefile",
"chars": 1883,
"preview": "##########################################################################################\n\n# Specify library locations "
},
{
"path": "BaseCode/include/Application.h",
"chars": 163,
"preview": "#ifndef DDG_APPLICATION_H\n#define DDG_APPLICATION_H\n\nnamespace DDG\n{\n class Application\n {\n\t //\n // TODO: add "
},
{
"path": "BaseCode/include/Camera.h",
"chars": 1976,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Camera.h\n// --------------"
},
{
"path": "BaseCode/include/Complex.h",
"chars": 2207,
"preview": "#ifndef DDG_COMPLEX_H\n#define DDG_COMPLEX_H\n\n#include <iosfwd>\n\nnamespace DDG\n{\n class Complex\n {\n public:\n "
},
{
"path": "BaseCode/include/DenseMatrix.h",
"chars": 5221,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DenseMatrix.h\n// ---------"
},
{
"path": "BaseCode/include/DiscreteExteriorCalculus.h",
"chars": 1623,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DiscreteExteriorCalculus.h"
},
{
"path": "BaseCode/include/Edge.h",
"chars": 732,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Edge.h\n// ----------------"
},
{
"path": "BaseCode/include/Face.h",
"chars": 1287,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Face.h\n// ----------------"
},
{
"path": "BaseCode/include/HalfEdge.h",
"chars": 1453,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- HalfEdge.h\n// ------------"
},
{
"path": "BaseCode/include/Image.h",
"chars": 1583,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Image.h\n// ---------------"
},
{
"path": "BaseCode/include/LinearContext.h",
"chars": 1071,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearContext.h\n// -------"
},
{
"path": "BaseCode/include/LinearEquation.h",
"chars": 1132,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearEquation.h\n// ------"
},
{
"path": "BaseCode/include/LinearPolynomial.h",
"chars": 4765,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearPolynomial.h\n// ----"
},
{
"path": "BaseCode/include/LinearSystem.h",
"chars": 2612,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearSystem.h\n// --------"
},
{
"path": "BaseCode/include/Mesh.h",
"chars": 3163,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- Mesh.h\r\n// --------------"
},
{
"path": "BaseCode/include/MeshIO.h",
"chars": 1756,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- MeshIO.h\r\n// ------------"
},
{
"path": "BaseCode/include/Quaternion.h",
"chars": 4847,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Quaternion.h\n// ----------"
},
{
"path": "BaseCode/include/Real.h",
"chars": 953,
"preview": "#ifndef DDG_REAL_H\n#define DDG_REAL_H\n\nnamespace DDG\n{\n class Real\n {\n public:\n Real( double x = 0. );\n"
},
{
"path": "BaseCode/include/Shader.h",
"chars": 1893,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Shader.h\n// --------------"
},
{
"path": "BaseCode/include/SparseMatrix.h",
"chars": 10702,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- SparseMatrix.h\n// --------"
},
{
"path": "BaseCode/include/Types.h",
"chars": 2053,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Types.h\n// ---------------"
},
{
"path": "BaseCode/include/Utility.h",
"chars": 510,
"preview": "#ifndef DDG_UTILITY_H\n#define DDG_UTILITY_H\n\n#include <cstdlib>\n#include \"Utility.h\"\n#include \"Complex.h\"\n\nnamespace DDG"
},
{
"path": "BaseCode/include/Variable.h",
"chars": 2190,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Variable.h\n// ------------"
},
{
"path": "BaseCode/include/Vector.h",
"chars": 3167,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vector.h\n// --------------"
},
{
"path": "BaseCode/include/Vertex.h",
"chars": 1372,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vertex.h\n// --------------"
},
{
"path": "BaseCode/include/Viewer.h",
"chars": 2752,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Viewer.h\n// --------------"
},
{
"path": "BaseCode/obj/.empty",
"chars": 0,
"preview": ""
},
{
"path": "BaseCode/shaders/fragment.glsl",
"chars": 822,
"preview": "uniform vec3 eye;\r\nuniform vec3 light;\r\nvarying vec3 position;\r\nvarying vec3 normal;\r\n\r\nfloat diffuse( vec3 N, vec3 L )\r"
},
{
"path": "BaseCode/shaders/vertex.glsl",
"chars": 221,
"preview": "varying vec3 position;\r\nvarying vec3 normal;\r\n\r\nvoid main()\r\n{\t\r\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vert"
},
{
"path": "BaseCode/src/Camera.cpp",
"chars": 2690,
"preview": "#include <cmath>\n#include <ctime>\n#include <algorithm>\nusing namespace std;\n\n#include \"Camera.h\"\n\nnamespace DDG\n{\n Cam"
},
{
"path": "BaseCode/src/Complex.cpp",
"chars": 3429,
"preview": "#include \"Complex.h\"\n#include <iostream>\n#include <cmath>\n\nusing namespace std;\n\nnamespace DDG\n{\n Complex::Complex( do"
},
{
"path": "BaseCode/src/DenseMatrix.cpp",
"chars": 7056,
"preview": "#include \"DenseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )\n //"
},
{
"path": "BaseCode/src/DenseMatrix.inl",
"chars": 8735,
"preview": "#include <cassert>\n#include <cmath>\n\n#include <algorithm>\n#include <iostream>\nusing namespace std;\n\n#include \"DenseMatri"
},
{
"path": "BaseCode/src/DiscreteExteriorCalculus.inl",
"chars": 3708,
"preview": "#include \"DiscreteExteriorCalculus.h\"\n\nnamespace DDG\n{\n template <class T>\n void HodgeStar0Form<T> :: build( const M"
},
{
"path": "BaseCode/src/Edge.cpp",
"chars": 57,
"preview": "#include \"Edge.h\"\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n\n}\n\n"
},
{
"path": "BaseCode/src/Face.cpp",
"chars": 1088,
"preview": "#include \"Face.h\"\n#include \"Mesh.h\"\n#include \"Vector.h\"\n\nnamespace DDG\n{\n double Face::area( void ) const\n {\n V"
},
{
"path": "BaseCode/src/HalfEdge.cpp",
"chars": 622,
"preview": "#include \"HalfEdge.h\"\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n double HalfEdge :: cotan( void ) const\n {\n if( onBoun"
},
{
"path": "BaseCode/src/Image.cpp",
"chars": 5959,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\n#include \"Image.h\"\n\nnam"
},
{
"path": "BaseCode/src/LinearContext.cpp",
"chars": 474,
"preview": "#include \"LinearContext.h\"\n\nnamespace DDG\n{\n // global context for linear solvers\n LinearContext context;\n\n Linear"
},
{
"path": "BaseCode/src/LinearEquation.cpp",
"chars": 345,
"preview": "#include \"LinearEquation.h\"\n\nnamespace DDG\n{\n LinearEquation operator==( const LinearPolynomial& lhs,\n "
},
{
"path": "BaseCode/src/LinearPolynomial.cpp",
"chars": 7244,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"LinearPolynomial.h\"\n#include \"Types.h\"\n\nnamespace DDG\n{\n LinearPol"
},
{
"path": "BaseCode/src/LinearSystem.cpp",
"chars": 3877,
"preview": "#include <map>\nusing namespace std;\n\n#include <SuiteSparseQR.hpp>\n\n#include \"LinearSystem.h\"\n#include \"LinearContext.h\"\n"
},
{
"path": "BaseCode/src/Mesh.cpp",
"chars": 6339,
"preview": "#include <map>\r\n#include <fstream>\r\n#include \"Mesh.h\"\r\n#include \"MeshIO.h\"\r\n#include \"DiscreteExteriorCalculus.h\"\r\n\r\nusi"
},
{
"path": "BaseCode/src/MeshIO.cpp",
"chars": 15702,
"preview": "#include <vector>\r\n#include <iostream>\r\n#include <map>\r\n#include <set>\r\n\r\n#include \"MeshIO.h\"\r\n#include \"Mesh.h\"\r\n\r\nusin"
},
{
"path": "BaseCode/src/Quaternion.cpp",
"chars": 6864,
"preview": "#include <cmath>\n#include <iostream>\nusing namespace std;\n\n#include \"Quaternion.h\"\n\nnamespace DDG\n{\n // CONSTRUCTORS -"
},
{
"path": "BaseCode/src/Real.cpp",
"chars": 1129,
"preview": "#include \"Real.h\"\n#include <cmath>\n\nnamespace DDG\n{\n Real :: Real( double x )\n // constructs real number with value "
},
{
"path": "BaseCode/src/Shader.cpp",
"chars": 3148,
"preview": "#include \"Shader.h\"\n\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\nnamespace DDG\n{\n Shader::Shader( voi"
},
{
"path": "BaseCode/src/SparseMatrix.cpp",
"chars": 6661,
"preview": "#include \"SparseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n const SparseMatrix<Real>& SparseMatrix<Real> :: operator=( "
},
{
"path": "BaseCode/src/SparseMatrix.inl",
"chars": 21202,
"preview": "#include <algorithm>\n#include <cassert>\n#include <iostream>\n#include <cmath>\n#include <complex>\nusing namespace std;\n\n#i"
},
{
"path": "BaseCode/src/Variable.cpp",
"chars": 783,
"preview": "#include \"Variable.h\"\n\nnamespace DDG\n{\n Variable :: Variable( double value_,\n bool fixed_ )\n "
},
{
"path": "BaseCode/src/Vector.cpp",
"chars": 2778,
"preview": "#include <math.h>\n\n#include \"Vector.h\"\n\nnamespace DDG\n{\n Vector :: Vector( void )\n : x( 0. ),\n y( 0. ),\n z( "
},
{
"path": "BaseCode/src/Vertex.cpp",
"chars": 1277,
"preview": "#include <vector>\nusing namespace std;\n\n#include \"Vertex.h\"\n#include \"Mesh.h\"\n#include \"HalfEdge.h\"\n\nnamespace DDG\n{\n "
},
{
"path": "BaseCode/src/Viewer.cpp",
"chars": 13710,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <iostream>\n#include <iomanip>\n#include <fstream>\n#include <sstream>\n#includ"
},
{
"path": "BaseCode/src/main.cpp",
"chars": 333,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"Viewer.h\"\n#include \"DenseMatrix.h\"\nusing namespace DDG;\n\nint main( i"
},
{
"path": "Connection/Makefile",
"chars": 1890,
"preview": "##########################################################################################\n\n# Specify library locations "
},
{
"path": "Connection/include/Application.h",
"chars": 4011,
"preview": "/*\n * Trivial Connections on Discrete Surfaces\n * Keenan Crane, Mathieu Desbun and Peter Schroeder\n * SGP 2010 / Compute"
},
{
"path": "Connection/include/Camera.h",
"chars": 1976,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Camera.h\n// --------------"
},
{
"path": "Connection/include/Complex.h",
"chars": 2207,
"preview": "#ifndef DDG_COMPLEX_H\n#define DDG_COMPLEX_H\n\n#include <iosfwd>\n\nnamespace DDG\n{\n class Complex\n {\n public:\n "
},
{
"path": "Connection/include/DenseMatrix.h",
"chars": 5221,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DenseMatrix.h\n// ---------"
},
{
"path": "Connection/include/Direction.h",
"chars": 5434,
"preview": "#ifndef DDG_DIRECTION_H\n#define DDG_DIRECTION_H\n\n#include \"Mesh.h\"\n#include \"Quaternion.h\"\n\nnamespace DDG\n{\n class Dir"
},
{
"path": "Connection/include/DiscreteExteriorCalculus.h",
"chars": 1623,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DiscreteExteriorCalculus.h"
},
{
"path": "Connection/include/Edge.h",
"chars": 732,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Edge.h\n// ----------------"
},
{
"path": "Connection/include/Face.h",
"chars": 1513,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Face.h\n// ----------------"
},
{
"path": "Connection/include/HalfEdge.h",
"chars": 1646,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- HalfEdge.h\n// ------------"
},
{
"path": "Connection/include/HarmonicBases.h",
"chars": 2527,
"preview": "#ifndef DDG_HARMONIC_BASES_H\n#define DDG_HARMONIC_BASES_H\n\n#include \"Mesh.h\"\n#include \"Real.h\"\n#include \"DenseMatrix.h\"\n"
},
{
"path": "Connection/include/Image.h",
"chars": 1583,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Image.h\n// ---------------"
},
{
"path": "Connection/include/LinearContext.h",
"chars": 1071,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearContext.h\n// -------"
},
{
"path": "Connection/include/LinearEquation.h",
"chars": 1132,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearEquation.h\n// ------"
},
{
"path": "Connection/include/LinearPolynomial.h",
"chars": 4765,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearPolynomial.h\n// ----"
},
{
"path": "Connection/include/LinearSystem.h",
"chars": 2612,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearSystem.h\n// --------"
},
{
"path": "Connection/include/Mesh.h",
"chars": 4587,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- Mesh.h\r\n// --------------"
},
{
"path": "Connection/include/MeshIO.h",
"chars": 1756,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- MeshIO.h\r\n// ------------"
},
{
"path": "Connection/include/Quaternion.h",
"chars": 4847,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Quaternion.h\n// ----------"
},
{
"path": "Connection/include/Real.h",
"chars": 953,
"preview": "#ifndef DDG_REAL_H\n#define DDG_REAL_H\n\nnamespace DDG\n{\n class Real\n {\n public:\n Real( double x = 0. );\n"
},
{
"path": "Connection/include/Shader.h",
"chars": 1893,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Shader.h\n// --------------"
},
{
"path": "Connection/include/SparseMatrix.h",
"chars": 10702,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- SparseMatrix.h\n// --------"
},
{
"path": "Connection/include/TreeCotree.h",
"chars": 5252,
"preview": "#ifndef DDG_TREE_COTREE_H\n#define DDG_TREE_COTREE_H\n\n#include <queue>\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n class TreeCo"
},
{
"path": "Connection/include/Types.h",
"chars": 2053,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Types.h\n// ---------------"
},
{
"path": "Connection/include/Utility.h",
"chars": 510,
"preview": "#ifndef DDG_UTILITY_H\n#define DDG_UTILITY_H\n\n#include <cstdlib>\n#include \"Utility.h\"\n#include \"Complex.h\"\n\nnamespace DDG"
},
{
"path": "Connection/include/Variable.h",
"chars": 2190,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Variable.h\n// ------------"
},
{
"path": "Connection/include/Vector.h",
"chars": 3167,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vector.h\n// --------------"
},
{
"path": "Connection/include/Vertex.h",
"chars": 1792,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vertex.h\n// --------------"
},
{
"path": "Connection/include/Viewer.h",
"chars": 4315,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Viewer.h\n// --------------"
},
{
"path": "Connection/obj/.empty",
"chars": 0,
"preview": ""
},
{
"path": "Connection/shaders/fragment.glsl",
"chars": 822,
"preview": "uniform vec3 eye;\r\nuniform vec3 light;\r\nvarying vec3 position;\r\nvarying vec3 normal;\r\n\r\nfloat diffuse( vec3 N, vec3 L )\r"
},
{
"path": "Connection/shaders/vertex.glsl",
"chars": 221,
"preview": "varying vec3 position;\r\nvarying vec3 normal;\r\n\r\nvoid main()\r\n{\t\r\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vert"
},
{
"path": "Connection/src/Camera.cpp",
"chars": 2690,
"preview": "#include <cmath>\n#include <ctime>\n#include <algorithm>\nusing namespace std;\n\n#include \"Camera.h\"\n\nnamespace DDG\n{\n Cam"
},
{
"path": "Connection/src/Complex.cpp",
"chars": 3429,
"preview": "#include \"Complex.h\"\n#include <iostream>\n#include <cmath>\n\nusing namespace std;\n\nnamespace DDG\n{\n Complex::Complex( do"
},
{
"path": "Connection/src/DenseMatrix.cpp",
"chars": 7056,
"preview": "#include \"DenseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )\n //"
},
{
"path": "Connection/src/DenseMatrix.inl",
"chars": 8735,
"preview": "#include <cassert>\n#include <cmath>\n\n#include <algorithm>\n#include <iostream>\nusing namespace std;\n\n#include \"DenseMatri"
},
{
"path": "Connection/src/DiscreteExteriorCalculus.inl",
"chars": 3708,
"preview": "#include \"DiscreteExteriorCalculus.h\"\n\nnamespace DDG\n{\n template <class T>\n void HodgeStar0Form<T> :: build( const M"
},
{
"path": "Connection/src/Edge.cpp",
"chars": 57,
"preview": "#include \"Edge.h\"\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n\n}\n\n"
},
{
"path": "Connection/src/Face.cpp",
"chars": 1088,
"preview": "#include \"Face.h\"\n#include \"Mesh.h\"\n#include \"Vector.h\"\n\nnamespace DDG\n{\n double Face::area( void ) const\n {\n V"
},
{
"path": "Connection/src/HalfEdge.cpp",
"chars": 1008,
"preview": "#include \"HalfEdge.h\"\n#include \"Mesh.h\"\n#include \"Vector.h\"\n#include \"Quaternion.h\"\n\nnamespace DDG\n{\n double HalfEdge "
},
{
"path": "Connection/src/Image.cpp",
"chars": 5959,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\n#include \"Image.h\"\n\nnam"
},
{
"path": "Connection/src/LinearContext.cpp",
"chars": 474,
"preview": "#include \"LinearContext.h\"\n\nnamespace DDG\n{\n // global context for linear solvers\n LinearContext context;\n\n Linear"
},
{
"path": "Connection/src/LinearEquation.cpp",
"chars": 345,
"preview": "#include \"LinearEquation.h\"\n\nnamespace DDG\n{\n LinearEquation operator==( const LinearPolynomial& lhs,\n "
},
{
"path": "Connection/src/LinearPolynomial.cpp",
"chars": 7244,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"LinearPolynomial.h\"\n#include \"Types.h\"\n\nnamespace DDG\n{\n LinearPol"
},
{
"path": "Connection/src/LinearSystem.cpp",
"chars": 3877,
"preview": "#include <map>\nusing namespace std;\n\n#include <SuiteSparseQR.hpp>\n\n#include \"LinearSystem.h\"\n#include \"LinearContext.h\"\n"
},
{
"path": "Connection/src/Mesh.cpp",
"chars": 10550,
"preview": "#include <map>\r\n#include <fstream>\r\n#include \"Mesh.h\"\r\n#include \"MeshIO.h\"\r\n#include \"DiscreteExteriorCalculus.h\"\r\n#incl"
},
{
"path": "Connection/src/MeshIO.cpp",
"chars": 15702,
"preview": "#include <vector>\r\n#include <iostream>\r\n#include <map>\r\n#include <set>\r\n\r\n#include \"MeshIO.h\"\r\n#include \"Mesh.h\"\r\n\r\nusin"
},
{
"path": "Connection/src/Quaternion.cpp",
"chars": 6864,
"preview": "#include <cmath>\n#include <iostream>\nusing namespace std;\n\n#include \"Quaternion.h\"\n\nnamespace DDG\n{\n // CONSTRUCTORS -"
},
{
"path": "Connection/src/Real.cpp",
"chars": 1129,
"preview": "#include \"Real.h\"\n#include <cmath>\n\nnamespace DDG\n{\n Real :: Real( double x )\n // constructs real number with value "
},
{
"path": "Connection/src/Shader.cpp",
"chars": 3148,
"preview": "#include \"Shader.h\"\n\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\nnamespace DDG\n{\n Shader::Shader( voi"
},
{
"path": "Connection/src/SparseMatrix.cpp",
"chars": 6661,
"preview": "#include \"SparseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n const SparseMatrix<Real>& SparseMatrix<Real> :: operator=( "
},
{
"path": "Connection/src/SparseMatrix.inl",
"chars": 21202,
"preview": "#include <algorithm>\n#include <cassert>\n#include <iostream>\n#include <cmath>\n#include <complex>\nusing namespace std;\n\n#i"
},
{
"path": "Connection/src/Variable.cpp",
"chars": 783,
"preview": "#include \"Variable.h\"\n\nnamespace DDG\n{\n Variable :: Variable( double value_,\n bool fixed_ )\n "
},
{
"path": "Connection/src/Vector.cpp",
"chars": 2778,
"preview": "#include <math.h>\n\n#include \"Vector.h\"\n\nnamespace DDG\n{\n Vector :: Vector( void )\n : x( 0. ),\n y( 0. ),\n z( "
},
{
"path": "Connection/src/Vertex.cpp",
"chars": 1759,
"preview": "#include <vector>\nusing namespace std;\n\n#include \"Vertex.h\"\n#include \"Mesh.h\"\n#include \"HalfEdge.h\"\n\nnamespace DDG\n{\n "
},
{
"path": "Connection/src/Viewer.cpp",
"chars": 23956,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <iostream>\n#include <iomanip>\n#include <fstream>\n#include <sstream>\n#includ"
},
{
"path": "Connection/src/main.cpp",
"chars": 435,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"Viewer.h\"\n#include \"Direction.h\"\nusing namespace DDG;\n\nint main( int"
},
{
"path": "Elasticity/.viewer_state.txt",
"chars": 48,
"preview": "0.126663\n-0.0243652\n-0.989174\n0.0699843\n815\n767\n"
},
{
"path": "Elasticity/Makefile",
"chars": 1890,
"preview": "##########################################################################################\n\n# Specify library locations "
},
{
"path": "Elasticity/include/Application.h",
"chars": 6360,
"preview": "/*\n * A Simple Geometric Model for Elastic Deformations\n * Isaac Chao, Ulrich Pinkall, Patrick Sanan, Peter Schröder\n * "
},
{
"path": "Elasticity/include/Camera.h",
"chars": 1976,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Camera.h\n// --------------"
},
{
"path": "Elasticity/include/Complex.h",
"chars": 2207,
"preview": "#ifndef DDG_COMPLEX_H\n#define DDG_COMPLEX_H\n\n#include <iosfwd>\n\nnamespace DDG\n{\n class Complex\n {\n public:\n "
},
{
"path": "Elasticity/include/DenseMatrix.h",
"chars": 5221,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DenseMatrix.h\n// ---------"
},
{
"path": "Elasticity/include/DiscreteExteriorCalculus.h",
"chars": 1623,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DiscreteExteriorCalculus.h"
},
{
"path": "Elasticity/include/Edge.h",
"chars": 732,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Edge.h\n// ----------------"
},
{
"path": "Elasticity/include/Face.h",
"chars": 1287,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Face.h\n// ----------------"
},
{
"path": "Elasticity/include/HalfEdge.h",
"chars": 1453,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- HalfEdge.h\n// ------------"
},
{
"path": "Elasticity/include/Image.h",
"chars": 1583,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Image.h\n// ---------------"
},
{
"path": "Elasticity/include/LinearContext.h",
"chars": 1071,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearContext.h\n// -------"
},
{
"path": "Elasticity/include/LinearEquation.h",
"chars": 1132,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearEquation.h\n// ------"
},
{
"path": "Elasticity/include/LinearPolynomial.h",
"chars": 4765,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearPolynomial.h\n// ----"
},
{
"path": "Elasticity/include/LinearSystem.h",
"chars": 2612,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearSystem.h\n// --------"
},
{
"path": "Elasticity/include/Mesh.h",
"chars": 3163,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- Mesh.h\r\n// --------------"
},
{
"path": "Elasticity/include/MeshIO.h",
"chars": 1756,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- MeshIO.h\r\n// ------------"
},
{
"path": "Elasticity/include/PolarDecomposition2x2.h",
"chars": 846,
"preview": "#ifndef POLAR_DECOMPOSITION_2x2_H\n#define POLAR_DECOMPOSITION_2x2_H\n\n#include \"Complex.h\"\n#include \"DenseMatrix.h\"\n\nname"
},
{
"path": "Elasticity/include/Quaternion.h",
"chars": 4847,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Quaternion.h\n// ----------"
},
{
"path": "Elasticity/include/Real.h",
"chars": 953,
"preview": "#ifndef DDG_REAL_H\n#define DDG_REAL_H\n\nnamespace DDG\n{\n class Real\n {\n public:\n Real( double x = 0. );\n"
},
{
"path": "Elasticity/include/Shader.h",
"chars": 1893,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Shader.h\n// --------------"
},
{
"path": "Elasticity/include/SparseMatrix.h",
"chars": 10702,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- SparseMatrix.h\n// --------"
},
{
"path": "Elasticity/include/Types.h",
"chars": 2053,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Types.h\n// ---------------"
},
{
"path": "Elasticity/include/Utility.h",
"chars": 510,
"preview": "#ifndef DDG_UTILITY_H\n#define DDG_UTILITY_H\n\n#include <cstdlib>\n#include \"Utility.h\"\n#include \"Complex.h\"\n\nnamespace DDG"
},
{
"path": "Elasticity/include/Variable.h",
"chars": 2190,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Variable.h\n// ------------"
},
{
"path": "Elasticity/include/Vector.h",
"chars": 3167,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vector.h\n// --------------"
},
{
"path": "Elasticity/include/Vertex.h",
"chars": 1372,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vertex.h\n// --------------"
},
{
"path": "Elasticity/include/Viewer.h",
"chars": 3044,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Viewer.h\n// --------------"
},
{
"path": "Elasticity/obj/.empty",
"chars": 0,
"preview": ""
},
{
"path": "Elasticity/shaders/fragment.glsl",
"chars": 822,
"preview": "uniform vec3 eye;\r\nuniform vec3 light;\r\nvarying vec3 position;\r\nvarying vec3 normal;\r\n\r\nfloat diffuse( vec3 N, vec3 L )\r"
},
{
"path": "Elasticity/shaders/vertex.glsl",
"chars": 221,
"preview": "varying vec3 position;\r\nvarying vec3 normal;\r\n\r\nvoid main()\r\n{\t\r\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vert"
},
{
"path": "Elasticity/src/Camera.cpp",
"chars": 2690,
"preview": "#include <cmath>\n#include <ctime>\n#include <algorithm>\nusing namespace std;\n\n#include \"Camera.h\"\n\nnamespace DDG\n{\n Cam"
},
{
"path": "Elasticity/src/Complex.cpp",
"chars": 3429,
"preview": "#include \"Complex.h\"\n#include <iostream>\n#include <cmath>\n\nusing namespace std;\n\nnamespace DDG\n{\n Complex::Complex( do"
},
{
"path": "Elasticity/src/DenseMatrix.cpp",
"chars": 7056,
"preview": "#include \"DenseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n cholmod_dense* DenseMatrix<Real> :: to_cholmod( void )\n //"
},
{
"path": "Elasticity/src/DenseMatrix.inl",
"chars": 8735,
"preview": "#include <cassert>\n#include <cmath>\n\n#include <algorithm>\n#include <iostream>\nusing namespace std;\n\n#include \"DenseMatri"
},
{
"path": "Elasticity/src/DiscreteExteriorCalculus.inl",
"chars": 3708,
"preview": "#include \"DiscreteExteriorCalculus.h\"\n\nnamespace DDG\n{\n template <class T>\n void HodgeStar0Form<T> :: build( const M"
},
{
"path": "Elasticity/src/Edge.cpp",
"chars": 57,
"preview": "#include \"Edge.h\"\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n\n}\n\n"
},
{
"path": "Elasticity/src/Face.cpp",
"chars": 1088,
"preview": "#include \"Face.h\"\n#include \"Mesh.h\"\n#include \"Vector.h\"\n\nnamespace DDG\n{\n double Face::area( void ) const\n {\n V"
},
{
"path": "Elasticity/src/HalfEdge.cpp",
"chars": 628,
"preview": "#include \"HalfEdge.h\"\n#include \"Mesh.h\"\n\nnamespace DDG\n{\n double HalfEdge :: cotan( void ) const\n {\n if( onBoun"
},
{
"path": "Elasticity/src/Image.cpp",
"chars": 5959,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\n#include \"Image.h\"\n\nnam"
},
{
"path": "Elasticity/src/LinearContext.cpp",
"chars": 474,
"preview": "#include \"LinearContext.h\"\n\nnamespace DDG\n{\n // global context for linear solvers\n LinearContext context;\n\n Linear"
},
{
"path": "Elasticity/src/LinearEquation.cpp",
"chars": 345,
"preview": "#include \"LinearEquation.h\"\n\nnamespace DDG\n{\n LinearEquation operator==( const LinearPolynomial& lhs,\n "
},
{
"path": "Elasticity/src/LinearPolynomial.cpp",
"chars": 7244,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"LinearPolynomial.h\"\n#include \"Types.h\"\n\nnamespace DDG\n{\n LinearPol"
},
{
"path": "Elasticity/src/LinearSystem.cpp",
"chars": 3877,
"preview": "#include <map>\nusing namespace std;\n\n#include <SuiteSparseQR.hpp>\n\n#include \"LinearSystem.h\"\n#include \"LinearContext.h\"\n"
},
{
"path": "Elasticity/src/Mesh.cpp",
"chars": 6339,
"preview": "#include <map>\r\n#include <fstream>\r\n#include \"Mesh.h\"\r\n#include \"MeshIO.h\"\r\n#include \"DiscreteExteriorCalculus.h\"\r\n\r\nusi"
},
{
"path": "Elasticity/src/MeshIO.cpp",
"chars": 15702,
"preview": "#include <vector>\r\n#include <iostream>\r\n#include <map>\r\n#include <set>\r\n\r\n#include \"MeshIO.h\"\r\n#include \"Mesh.h\"\r\n\r\nusin"
},
{
"path": "Elasticity/src/Quaternion.cpp",
"chars": 6864,
"preview": "#include <cmath>\n#include <iostream>\nusing namespace std;\n\n#include \"Quaternion.h\"\n\nnamespace DDG\n{\n // CONSTRUCTORS -"
},
{
"path": "Elasticity/src/Real.cpp",
"chars": 1129,
"preview": "#include \"Real.h\"\n#include <cmath>\n\nnamespace DDG\n{\n Real :: Real( double x )\n // constructs real number with value "
},
{
"path": "Elasticity/src/Shader.cpp",
"chars": 3148,
"preview": "#include \"Shader.h\"\n\n#include <fstream>\n#include <iostream>\nusing namespace std;\n\nnamespace DDG\n{\n Shader::Shader( voi"
},
{
"path": "Elasticity/src/SparseMatrix.cpp",
"chars": 6661,
"preview": "#include \"SparseMatrix.h\"\n\nnamespace DDG\n{\n template <>\n const SparseMatrix<Real>& SparseMatrix<Real> :: operator=( "
},
{
"path": "Elasticity/src/SparseMatrix.inl",
"chars": 21202,
"preview": "#include <algorithm>\n#include <cassert>\n#include <iostream>\n#include <cmath>\n#include <complex>\nusing namespace std;\n\n#i"
},
{
"path": "Elasticity/src/Variable.cpp",
"chars": 783,
"preview": "#include \"Variable.h\"\n\nnamespace DDG\n{\n Variable :: Variable( double value_,\n bool fixed_ )\n "
},
{
"path": "Elasticity/src/Vector.cpp",
"chars": 2778,
"preview": "#include <math.h>\n\n#include \"Vector.h\"\n\nnamespace DDG\n{\n Vector :: Vector( void )\n : x( 0. ),\n y( 0. ),\n z( "
},
{
"path": "Elasticity/src/Vertex.cpp",
"chars": 1277,
"preview": "#include <vector>\nusing namespace std;\n\n#include \"Vertex.h\"\n#include \"Mesh.h\"\n#include \"HalfEdge.h\"\n\nnamespace DDG\n{\n "
},
{
"path": "Elasticity/src/Viewer.cpp",
"chars": 12586,
"preview": "#include <cmath>\n#include <cstdlib>\n#include <iostream>\n#include <iomanip>\n#include <fstream>\n#include <sstream>\n#includ"
},
{
"path": "Elasticity/src/main.cpp",
"chars": 445,
"preview": "#include <iostream>\nusing namespace std;\n\n#include \"Viewer.h\"\n#include \"DenseMatrix.h\"\nusing namespace DDG;\n\nint main( i"
},
{
"path": "Fairing/.viewer_state.txt",
"chars": 48,
"preview": "0.126663\n-0.0243652\n-0.989174\n0.0699843\n815\n767\n"
},
{
"path": "Fairing/Makefile",
"chars": 1887,
"preview": "##########################################################################################\n\n# Specify library locations "
},
{
"path": "Fairing/include/Application.h",
"chars": 1852,
"preview": "/*\n * Implicit Fairing of Arbitrary Meshes using Diffusion and Curvature Flow\n * Mathieu Desbrun, Mark Meyer, Peter Schr"
},
{
"path": "Fairing/include/Camera.h",
"chars": 1976,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Camera.h\n// --------------"
},
{
"path": "Fairing/include/Complex.h",
"chars": 2207,
"preview": "#ifndef DDG_COMPLEX_H\n#define DDG_COMPLEX_H\n\n#include <iosfwd>\n\nnamespace DDG\n{\n class Complex\n {\n public:\n "
},
{
"path": "Fairing/include/DenseMatrix.h",
"chars": 5221,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DenseMatrix.h\n// ---------"
},
{
"path": "Fairing/include/DiscreteExteriorCalculus.h",
"chars": 1623,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- DiscreteExteriorCalculus.h"
},
{
"path": "Fairing/include/Edge.h",
"chars": 732,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Edge.h\n// ----------------"
},
{
"path": "Fairing/include/Face.h",
"chars": 1287,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Face.h\n// ----------------"
},
{
"path": "Fairing/include/HalfEdge.h",
"chars": 1453,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- HalfEdge.h\n// ------------"
},
{
"path": "Fairing/include/Image.h",
"chars": 1583,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Image.h\n// ---------------"
},
{
"path": "Fairing/include/LinearContext.h",
"chars": 1071,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearContext.h\n// -------"
},
{
"path": "Fairing/include/LinearEquation.h",
"chars": 1132,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearEquation.h\n// ------"
},
{
"path": "Fairing/include/LinearPolynomial.h",
"chars": 4765,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearPolynomial.h\n// ----"
},
{
"path": "Fairing/include/LinearSystem.h",
"chars": 2612,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- LinearSystem.h\n// --------"
},
{
"path": "Fairing/include/Mesh.h",
"chars": 3163,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- Mesh.h\r\n// --------------"
},
{
"path": "Fairing/include/MeshIO.h",
"chars": 1756,
"preview": "// -----------------------------------------------------------------------------\r\n// libDDG -- MeshIO.h\r\n// ------------"
},
{
"path": "Fairing/include/Quaternion.h",
"chars": 4847,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Quaternion.h\n// ----------"
},
{
"path": "Fairing/include/Real.h",
"chars": 953,
"preview": "#ifndef DDG_REAL_H\n#define DDG_REAL_H\n\nnamespace DDG\n{\n class Real\n {\n public:\n Real( double x = 0. );\n"
},
{
"path": "Fairing/include/Shader.h",
"chars": 1893,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Shader.h\n// --------------"
},
{
"path": "Fairing/include/SparseMatrix.h",
"chars": 10702,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- SparseMatrix.h\n// --------"
},
{
"path": "Fairing/include/Types.h",
"chars": 2053,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Types.h\n// ---------------"
},
{
"path": "Fairing/include/Utility.h",
"chars": 510,
"preview": "#ifndef DDG_UTILITY_H\n#define DDG_UTILITY_H\n\n#include <cstdlib>\n#include \"Utility.h\"\n#include \"Complex.h\"\n\nnamespace DDG"
},
{
"path": "Fairing/include/Variable.h",
"chars": 2190,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Variable.h\n// ------------"
},
{
"path": "Fairing/include/Vector.h",
"chars": 3167,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vector.h\n// --------------"
},
{
"path": "Fairing/include/Vertex.h",
"chars": 1372,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Vertex.h\n// --------------"
},
{
"path": "Fairing/include/Viewer.h",
"chars": 2975,
"preview": "// -----------------------------------------------------------------------------\n// libDDG -- Viewer.h\n// --------------"
},
{
"path": "Fairing/obj/.empty",
"chars": 0,
"preview": ""
},
{
"path": "Fairing/shaders/fragment.glsl",
"chars": 822,
"preview": "uniform vec3 eye;\r\nuniform vec3 light;\r\nvarying vec3 position;\r\nvarying vec3 normal;\r\n\r\nfloat diffuse( vec3 N, vec3 L )\r"
},
{
"path": "Fairing/shaders/vertex.glsl",
"chars": 221,
"preview": "varying vec3 position;\r\nvarying vec3 normal;\r\n\r\nvoid main()\r\n{\t\r\n gl_Position = gl_ModelViewProjectionMatrix * gl_Vert"
},
{
"path": "Fairing/src/Camera.cpp",
"chars": 2690,
"preview": "#include <cmath>\n#include <ctime>\n#include <algorithm>\nusing namespace std;\n\n#include \"Camera.h\"\n\nnamespace DDG\n{\n Cam"
}
]
// ... and 193 more files (download for full content)
About this extraction
This page contains the full source code of the dgpdec/course GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 393 files (59.4 MB), approximately 357.5k tokens, and a symbol index with 1044 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.