mirror of
https://github.com/lgfischer/dcel.git
synced 2026-11-16 00:07:05 -03:00
The first commit
This commit is contained in:
commit
907922fdee
45 files changed
+7594
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DCEL_Example", "DCEL_Example.vcproj", "{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
Name="DCEL_Example"
|
||||||
|
ProjectGUID="{6E4B73C0-2BD7-4E6C-B52E-F5D157D0E98A}"
|
||||||
|
RootNamespace="DCEL_Example"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="2"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
LinkIncremental="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="1"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\main.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<Filter
|
||||||
|
Name="DCEL"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\WavefrontObjImporter.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<Filter
|
||||||
|
Name="DCEL"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\DCELStream.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\EdgeIterator.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\Exception.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\Face.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\HalfEdge.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\Mesh.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\Vector3.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\Vertex.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\source\DCEL\WavefrontObjImporter.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
DCEL Library by Leonardo Garcia Fischer - Licence of Use
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef DCELStream_h
|
||||||
|
#define DCELStream_h
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "Mesh.h"
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
class DCELStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static void read(MeshT& mesh, std::istream &stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Format:
|
||||||
|
|
||||||
|
version 1
|
||||||
|
#this is a comment
|
||||||
|
vc <number of vertices in the mesh>
|
||||||
|
fc <number of faces in the mesh>
|
||||||
|
ec <number of edges in the mesh>
|
||||||
|
v <custom user data>
|
||||||
|
... # repeat v for vc times, one for each vertex
|
||||||
|
f <number of vertices that define this face> <list of id of each vertex> <custom user data>
|
||||||
|
... # repeat f for fc times, one for each face
|
||||||
|
e <id of the source vertex of the edge> <id of the source of the twin edge> <custom user data>
|
||||||
|
... # repeat e for ec times, one for each half edge
|
||||||
|
end
|
||||||
|
*/
|
||||||
|
static void write(const MeshT& mesh, std::ostream &stream);
|
||||||
|
|
||||||
|
template<class MeshT, class MeshT2>
|
||||||
|
static void copyDcelData(const MeshT& source, MeshT2& target )
|
||||||
|
{
|
||||||
|
const MeshT::Vertex* vertex = NULL;
|
||||||
|
const unsigned int numVertices = source.getNumVertices();
|
||||||
|
const MeshT::Face* face = NULL;
|
||||||
|
const unsigned int numFaces = source.getNumFaces();
|
||||||
|
const MeshT::HalfEdge* edge = NULL;
|
||||||
|
const unsigned int numEdges = source.getNumHalfEdges();
|
||||||
|
|
||||||
|
target.clear();
|
||||||
|
target.getVertices().reserve( numVertices );
|
||||||
|
target.getFaces().reserve( numFaces );
|
||||||
|
target.getHalfEdges().reserve( numEdges );
|
||||||
|
|
||||||
|
for( unsigned int vertexId=0; vertexId<numVertices; ++vertexId )
|
||||||
|
{
|
||||||
|
target.createVertex();
|
||||||
|
|
||||||
|
// convert here the data from the source to target vertex
|
||||||
|
}
|
||||||
|
for( unsigned int faceId=0; faceId<numFaces; ++faceId )
|
||||||
|
{
|
||||||
|
face = source.getFace( faceId );
|
||||||
|
|
||||||
|
unsigned int vid[3];//generalizar
|
||||||
|
unsigned int vertexCount=0;
|
||||||
|
MeshT::EdgeIterator it(face);
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
vid[vertexCount] = source.getVertexId( it.getNext()->getOrigin() );
|
||||||
|
++vertexCount;
|
||||||
|
}
|
||||||
|
target.createTriangularFace( vid[0], vid[1], vid[2] );
|
||||||
|
|
||||||
|
// convert here the data from the source to target faces
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
for( unsigned int edgeId=0; edgeId<numEdges; ++edgeId )
|
||||||
|
{
|
||||||
|
// convert here the data from the source to target half-edges
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
|
||||||
|
static void read_v1(MeshT& mesh, std::istream &stream);
|
||||||
|
|
||||||
|
static void consumeComment(const std::string& commentBegin, std::istream &stream);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// IMPLEMENTATION //
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void DCELStream<MeshT>::read(MeshT& mesh, std::istream &stream)
|
||||||
|
{
|
||||||
|
while( stream.good() )
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
stream >> str;
|
||||||
|
if( str=="version" )
|
||||||
|
{
|
||||||
|
unsigned int version;
|
||||||
|
stream >> version;
|
||||||
|
switch(version)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
read_v1(mesh, stream);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "Warning: unknown version " << version << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( str.at(0)=='#' )
|
||||||
|
{
|
||||||
|
consumeComment(str, stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Unknown line: " << str << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void DCELStream<MeshT>::write(const MeshT& mesh, std::ostream &stream)
|
||||||
|
{
|
||||||
|
const MeshT::Vertex* vertex = NULL;
|
||||||
|
const unsigned int numVertices = mesh.getNumVertices();
|
||||||
|
const MeshT::Face* face = NULL;
|
||||||
|
const unsigned int numFaces = mesh.getNumFaces();
|
||||||
|
const MeshT::HalfEdge* edge = NULL;
|
||||||
|
const unsigned int numEdges = mesh.getNumHalfEdges();
|
||||||
|
|
||||||
|
stream << "version 1" << std::endl;
|
||||||
|
|
||||||
|
stream << "vc " << numVertices << std::endl;
|
||||||
|
stream << "fc " << numFaces << std::endl;
|
||||||
|
stream << "ec " << numEdges << std::endl;
|
||||||
|
|
||||||
|
for( unsigned int vertexId=0; vertexId<numVertices; ++vertexId )
|
||||||
|
{
|
||||||
|
vertex = mesh.getVertex( vertexId );
|
||||||
|
stream << "v " << vertex->getData() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( unsigned int faceId=0; faceId<numFaces; ++faceId )
|
||||||
|
{
|
||||||
|
face = mesh.getFace( faceId );
|
||||||
|
stream << "f ";
|
||||||
|
|
||||||
|
unsigned int vid[3];//generalizar
|
||||||
|
unsigned int vertexCount=0;
|
||||||
|
MeshT::EdgeIterator it(face);
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
vid[vertexCount] = mesh.getVertexId( it.getNext()->getOrigin() );
|
||||||
|
++vertexCount;
|
||||||
|
}
|
||||||
|
stream << vertexCount;
|
||||||
|
for( unsigned int v=0; v<vertexCount; ++v )
|
||||||
|
{
|
||||||
|
stream << " " << vid[v];
|
||||||
|
}
|
||||||
|
stream << " " << face->getData();
|
||||||
|
stream << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( unsigned int edgeId=0; edgeId<numEdges; ++edgeId )
|
||||||
|
{
|
||||||
|
const MeshT::HalfEdge* edge = mesh.getHalfEdge( edgeId );
|
||||||
|
stream << "e " << mesh.getVertexId( edge->getOrigin() )
|
||||||
|
<< " " << mesh.getVertexId( edge->getTwin()->getOrigin() )
|
||||||
|
<< " " << edge->getData() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream << "end";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void DCELStream<MeshT>::read_v1(MeshT& mesh, std::istream &stream)
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
|
||||||
|
bool reading = true;
|
||||||
|
while( reading && stream.good() )
|
||||||
|
{
|
||||||
|
stream >> str;
|
||||||
|
|
||||||
|
if( str=="v" )
|
||||||
|
{
|
||||||
|
MeshT::Vertex* vertex = mesh.getVertex( mesh.createVertex() );
|
||||||
|
stream >> (vertex->getData());
|
||||||
|
}
|
||||||
|
else if( str=="f" )
|
||||||
|
{
|
||||||
|
unsigned int vertexCount;
|
||||||
|
stream >> vertexCount;
|
||||||
|
unsigned int vid[3];//TODO generalize
|
||||||
|
for( unsigned int i=0; i<vertexCount; ++i )
|
||||||
|
stream >> (vid[i]);
|
||||||
|
|
||||||
|
unsigned int fid = mesh.createTriangularFace( vid[0], vid[1], vid[2] );
|
||||||
|
MeshT::Face* face = mesh.getFace( fid );
|
||||||
|
stream >> face->getData();
|
||||||
|
}
|
||||||
|
else if( str=="e" )
|
||||||
|
{
|
||||||
|
unsigned int from, to;
|
||||||
|
stream >> from >> to;
|
||||||
|
MeshT::HalfEdge* edge = mesh.getHalfEdge( mesh.getVertex(from), mesh.getVertex(to) );
|
||||||
|
if( edge )
|
||||||
|
{
|
||||||
|
stream >> edge->getData();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << '?';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( str=="vc" )
|
||||||
|
{
|
||||||
|
unsigned int vc = -1;
|
||||||
|
stream >> vc;
|
||||||
|
mesh.getVertices().reserve( vc*5 );
|
||||||
|
}
|
||||||
|
else if( str=="fc" )
|
||||||
|
{
|
||||||
|
unsigned int fc = -1;
|
||||||
|
stream >> fc;
|
||||||
|
mesh.getFaces().reserve( fc*5 );
|
||||||
|
}
|
||||||
|
else if( str=="ec" )
|
||||||
|
{
|
||||||
|
unsigned int ec = -1;
|
||||||
|
stream >> ec;
|
||||||
|
mesh.getHalfEdges().reserve( ec*5 );
|
||||||
|
}
|
||||||
|
else if( str=="end" )
|
||||||
|
{
|
||||||
|
reading = false;
|
||||||
|
}
|
||||||
|
else if( str.at(0)=='#' )
|
||||||
|
{
|
||||||
|
consumeComment(str, stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Unknown line: " << str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mesh.manageUnhandledTriangles();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void DCELStream<MeshT>::consumeComment(const std::string& commentBegin, std::istream &stream)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
stream.getline( buffer, sizeof(buffer) );
|
||||||
|
std::cerr << commentBegin << " " << buffer << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif//DCELStream_h
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef DCEL_EdgeIterator_h
|
||||||
|
#define DCEL_EdgeIterator_h
|
||||||
|
|
||||||
|
#include "Vertex.h"
|
||||||
|
#include "Face.h"
|
||||||
|
#include "HalfEdge.h"
|
||||||
|
//#include <cassert>
|
||||||
|
|
||||||
|
/**
|
||||||
|
A class that helps the iteration of the edges of a vertice or face.
|
||||||
|
|
||||||
|
In the case of a vertex, it runs over each edge that has the given
|
||||||
|
edge as origin.
|
||||||
|
|
||||||
|
In the case of a face, it runs over each edge that forms the boundary
|
||||||
|
of that face.
|
||||||
|
*/
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class EdgeIteratorT
|
||||||
|
{
|
||||||
|
typedef VertexT<VertexDataT, HalfEdgeDataT, FaceDataT> Vertex;
|
||||||
|
typedef HalfEdgeT<VertexDataT, HalfEdgeDataT, FaceDataT> HalfEdge;
|
||||||
|
typedef FaceT<VertexDataT, HalfEdgeDataT, FaceDataT> Face;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates an EdgeIterator that runs over each edge that starts on the
|
||||||
|
given vertex.
|
||||||
|
*/
|
||||||
|
inline EdgeIteratorT(const Vertex* vertex)
|
||||||
|
{
|
||||||
|
reset(vertex);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates an EdgeIterator that runs over each edge that forms the
|
||||||
|
boundary of the given face.
|
||||||
|
*/
|
||||||
|
inline EdgeIteratorT(const Face* face)
|
||||||
|
{
|
||||||
|
reset(face);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the next edge in the sequence.
|
||||||
|
|
||||||
|
Returns NULL if all the sequence of edges has ended.
|
||||||
|
*/
|
||||||
|
inline HalfEdge* getNext()
|
||||||
|
{
|
||||||
|
HalfEdge* next = nextEdge;
|
||||||
|
|
||||||
|
if( nextEdge )
|
||||||
|
{
|
||||||
|
if( vertexIterator ) // edges starting at a vertex iterator
|
||||||
|
{
|
||||||
|
HalfEdge* twin = nextEdge->getTwin();
|
||||||
|
//assert(twin);
|
||||||
|
nextEdge = twin->getNext();
|
||||||
|
}
|
||||||
|
else // edges from face iterator
|
||||||
|
{
|
||||||
|
nextEdge = nextEdge->getNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( nextEdge==startEdge )
|
||||||
|
{
|
||||||
|
nextEdge = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check if there is any edge in the sequence of edges.
|
||||||
|
*/
|
||||||
|
inline bool hasNext() const
|
||||||
|
{
|
||||||
|
return nextEdge!=NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Makes the iterator start again, from the first edge
|
||||||
|
of the sequence.
|
||||||
|
*/
|
||||||
|
inline void reset()
|
||||||
|
{
|
||||||
|
nextEdge = startEdge;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void reset(const Vertex* vertex)
|
||||||
|
{
|
||||||
|
//assert(vertex);
|
||||||
|
vertexIterator = true;
|
||||||
|
startEdge = vertex->getIncidentEdge();
|
||||||
|
reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void reset(const Face* face)
|
||||||
|
{
|
||||||
|
//assert(face);
|
||||||
|
vertexIterator = false;
|
||||||
|
startEdge = face->getBoundary();
|
||||||
|
reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
HalfEdge* startEdge;
|
||||||
|
HalfEdge* nextEdge;
|
||||||
|
bool vertexIterator;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif//DCEL_EdgeIterator_h
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef Exception_h
|
||||||
|
#define Exception_h
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace cpp
|
||||||
|
{
|
||||||
|
class Exception: public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Exception(const char* m)
|
||||||
|
:msg(m)
|
||||||
|
{};
|
||||||
|
|
||||||
|
Exception(const std::string& msg)
|
||||||
|
: msg(msg)
|
||||||
|
{};
|
||||||
|
|
||||||
|
Exception(const std::exception& e)
|
||||||
|
: msg(e.what())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~Exception() throw()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Exception& operator=(const std::exception& e) throw()
|
||||||
|
{
|
||||||
|
this->msg = e.what();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char* what() const throw()
|
||||||
|
{
|
||||||
|
return msg.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const std::string& message() const
|
||||||
|
{
|
||||||
|
return this->msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string msg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif//Exception_h
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef DCEL_Face_h
|
||||||
|
#define DCEL_Face_h
|
||||||
|
|
||||||
|
//#include <cassert>
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class HalfEdgeT;
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class FaceT
|
||||||
|
{
|
||||||
|
typedef HalfEdgeT<VertexDataT, HalfEdgeDataT, FaceDataT> HalfEdge;
|
||||||
|
typedef FaceT<VertexDataT, HalfEdgeDataT, FaceDataT> Face;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FaceT():
|
||||||
|
boundary( NULL )
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdge* getBoundary() const
|
||||||
|
{
|
||||||
|
return this->boundary;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setBoundary(HalfEdge* bound)
|
||||||
|
{
|
||||||
|
//assert( this );
|
||||||
|
this->boundary = bound;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline FaceDataT& getData()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const FaceDataT& getData() const
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
HalfEdge* boundary;
|
||||||
|
FaceDataT data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif//DCEL_Face_h
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef DCEL_HalfEdge_h
|
||||||
|
#define DCEL_HalfEdge_h
|
||||||
|
|
||||||
|
//#include <cassert>
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class VertexT;
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class FaceT;
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class HalfEdgeT
|
||||||
|
{
|
||||||
|
typedef VertexT<VertexDataT, HalfEdgeDataT, FaceDataT> Vertex;
|
||||||
|
typedef HalfEdgeT<VertexDataT, HalfEdgeDataT, FaceDataT> HalfEdge;
|
||||||
|
typedef FaceT<VertexDataT, HalfEdgeDataT, FaceDataT> Face;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
HalfEdgeT( ):
|
||||||
|
data(),
|
||||||
|
twin(NULL),
|
||||||
|
next(NULL),
|
||||||
|
prev(NULL),
|
||||||
|
origin(NULL),
|
||||||
|
face(NULL)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdge* getTwin() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->twin;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setTwin(HalfEdge* newTwin)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->twin = newTwin;
|
||||||
|
newTwin->twin = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdge* getNext() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->next;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setNext(HalfEdge* newNext)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->next = newNext;
|
||||||
|
newNext->prev = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdge* getPrev() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setPrev(HalfEdge* newPrev)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->prev = newPrev;
|
||||||
|
newPrev->next = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline Vertex* getOrigin() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->origin;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setOrigin(Vertex* newOrigin)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->origin = newOrigin;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline Face* getFace() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->face;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setFace(Face* newFace)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->face = newFace;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdgeDataT& getData()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const HalfEdgeDataT& getData() const
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
HalfEdge* twin;
|
||||||
|
HalfEdge* next;
|
||||||
|
HalfEdge* prev;
|
||||||
|
Vertex* origin;
|
||||||
|
Face* face;
|
||||||
|
HalfEdgeDataT data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif//DCEL_HalfEdge_h
|
||||||
+1035
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,102 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "PlyImporter.h"
|
||||||
|
#include "../rply/rply.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
This code uses the RPly 1.01 library, from
|
||||||
|
http://w3.impa.br/~diego/software/rply/.
|
||||||
|
|
||||||
|
The code for this lib can be downloaded from
|
||||||
|
http://w3.impa.br/~diego/software/rply/rply-1.01.tar.gz. There is a copy of
|
||||||
|
the RPly 1.01 available with this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int vertex_cb(p_ply_argument argument)
|
||||||
|
{
|
||||||
|
PlyLoader* loader;
|
||||||
|
long coordinate;
|
||||||
|
|
||||||
|
ply_get_argument_user_data(argument, (void**)&loader, &coordinate);
|
||||||
|
float position = (float)ply_get_argument_value(argument);
|
||||||
|
switch(coordinate)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
loader->vertices.push_back( Vector3f(position,0,0) );
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
loader->vertices.back().y = position;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
loader->vertices.back().z = position;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int face_cb(p_ply_argument argument)
|
||||||
|
{
|
||||||
|
long length, value_index;
|
||||||
|
ply_get_argument_property(argument, NULL, &length, &value_index);
|
||||||
|
|
||||||
|
if( length!=3 ) //ensures only triangles are read
|
||||||
|
{
|
||||||
|
throw cpp::Exception("This file contains other things than triangles (1)!'");
|
||||||
|
}
|
||||||
|
unsigned int val = (unsigned int)ply_get_argument_value(argument);
|
||||||
|
if( value_index<0 )
|
||||||
|
{
|
||||||
|
if( val!=3 ) //ensures only triangles are read
|
||||||
|
{
|
||||||
|
throw cpp::Exception("This file contains other things than triangles (2)!'");
|
||||||
|
}
|
||||||
|
return 1; // just returns, this is not usefull data (its the size of the list that will follow)
|
||||||
|
}
|
||||||
|
|
||||||
|
PlyLoader* loader;
|
||||||
|
ply_get_argument_user_data(argument, (void**)&loader, NULL);
|
||||||
|
loader->faces.push_back( val );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_cb(const char *message)
|
||||||
|
{
|
||||||
|
std::cerr << message << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlyLoader::load( const std::string& plyFilename )
|
||||||
|
{
|
||||||
|
this->vertices.clear();
|
||||||
|
this->verticeCount = 0;
|
||||||
|
this->faces.clear();
|
||||||
|
this->faceCount = 0;
|
||||||
|
|
||||||
|
p_ply ply = ply_open(plyFilename.c_str(), error_cb);
|
||||||
|
if( !ply )
|
||||||
|
{
|
||||||
|
throw cpp::Exception(std::string("Cannot open the file '")+plyFilename+"'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ply_read_header(ply) )
|
||||||
|
{
|
||||||
|
throw cpp::Exception(std::string("Error loading the header of the file '")+plyFilename+"'");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->verticeCount = ply_set_read_cb(ply, "vertex", "x", vertex_cb, this, 0);
|
||||||
|
ply_set_read_cb(ply, "vertex", "y", vertex_cb, this, 1);
|
||||||
|
ply_set_read_cb(ply, "vertex", "z", vertex_cb, this, 2);
|
||||||
|
|
||||||
|
this->faceCount = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, this, 0);
|
||||||
|
if (!ply_read(ply))
|
||||||
|
{
|
||||||
|
throw cpp::Exception(std::string("Error loading the the whole file '")+plyFilename+"'");
|
||||||
|
}
|
||||||
|
ply_close(ply);
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PlyImporter_h
|
||||||
|
#define PlyImporter_h
|
||||||
|
|
||||||
|
#include "DCELStream.h"
|
||||||
|
#include "Vector3.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
This class is used internally by the PlyImporter, and should not be used externally.
|
||||||
|
|
||||||
|
It loads a set of vertices into the "vertices" list and the set of faces into the
|
||||||
|
"faces" list. Each 3 values into the "faces" lists stores one triangular face,
|
||||||
|
composed by the vertices referenced by the 3 unsigned int values.
|
||||||
|
*/
|
||||||
|
class PlyLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void load(const std::string& plyFilename);
|
||||||
|
|
||||||
|
std::list<Vector3f> vertices;
|
||||||
|
unsigned int verticeCount;
|
||||||
|
std::list<unsigned int> faces;
|
||||||
|
unsigned int faceCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Class that imports a PLY file into a DCEL mesh.
|
||||||
|
|
||||||
|
It assumes that the mesh is totally triangulated.
|
||||||
|
*/
|
||||||
|
template <class MeshT>
|
||||||
|
class PlyImporter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads from the given filename.
|
||||||
|
|
||||||
|
It just calls the 'import' method with the opened stream.
|
||||||
|
*/
|
||||||
|
void import( const std::string& plyFilename, MeshT& mesh );
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void PlyImporter<MeshT>::import( const std::string& plyFilename, MeshT& mesh )
|
||||||
|
{
|
||||||
|
std::cerr << "Starting importing the file '" << plyFilename << "'" << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "- loading the PLY file" << std::endl;
|
||||||
|
//loads the ply file
|
||||||
|
PlyLoader loader;
|
||||||
|
loader.load( plyFilename );
|
||||||
|
|
||||||
|
// put it into the mesh
|
||||||
|
std::cerr << "- loading the DCEL mesh: " << std::endl;
|
||||||
|
std::cerr << " + " << loader.verticeCount << " vertices" << std::endl;
|
||||||
|
mesh.clear();
|
||||||
|
mesh.getVertices().reserve(loader.verticeCount);
|
||||||
|
mesh.getFaces().reserve(loader.faceCount);
|
||||||
|
mesh.getHalfEdges().reserve( 2*(loader.verticeCount+loader.faceCount-2) ); // Euler: V – A + F = 2 --> A = V + F - 2
|
||||||
|
std::list<Vector3f>::iterator vit = loader.vertices.begin();
|
||||||
|
while( vit!=loader.vertices.end() )
|
||||||
|
{
|
||||||
|
unsigned int id = mesh.createVertex();
|
||||||
|
mesh.getVertex(id)->getData().position = *vit;
|
||||||
|
vit++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << " + " << loader.faceCount << " faces" << std::endl;
|
||||||
|
|
||||||
|
std::list<unsigned int>::iterator fit = loader.faces.begin();
|
||||||
|
unsigned int count=0;
|
||||||
|
while( fit!=loader.faces.end() )
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
unsigned int a = *fit; ++fit;
|
||||||
|
unsigned int b = *fit; ++fit;
|
||||||
|
unsigned int c = *fit; ++fit;
|
||||||
|
unsigned int fid = mesh.createTriangularFace( a, b, c );
|
||||||
|
if (fid!=-1)
|
||||||
|
{
|
||||||
|
mesh.checkFace(fid);
|
||||||
|
mesh.checkAllFaces();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << " + " << mesh.getNumUnhandledTriangles() << " bad triangles" << std::endl;
|
||||||
|
|
||||||
|
mesh.manageUnhandledTriangles();
|
||||||
|
mesh.checkAllFaces();
|
||||||
|
std::cerr << "Done!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif//PlyImporter_h
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef VECTOR_3_H
|
||||||
|
#define VECTOR_3_H
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Vector3
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vector3()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Vector3(T x, T y, T z)
|
||||||
|
:x(x)
|
||||||
|
,y(y)
|
||||||
|
,z(z)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Vector3(const Vector3<T>& v)
|
||||||
|
:x(v.x)
|
||||||
|
,y(v.y)
|
||||||
|
,z(v.z)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Vector3(const Vector3<T>* v)
|
||||||
|
:x(v->x)
|
||||||
|
,y(v->y)
|
||||||
|
,z(v->z)
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline void set(T x, T y, T z)
|
||||||
|
{
|
||||||
|
this->x = x;
|
||||||
|
this->y = y;
|
||||||
|
this->z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set(const Vector3<T>& other)
|
||||||
|
{
|
||||||
|
this->x = other.x;
|
||||||
|
this->y = other.y;
|
||||||
|
this->z = other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator=(const Vector3<T>& other)
|
||||||
|
{
|
||||||
|
this->x = other.x;
|
||||||
|
this->y = other.y;
|
||||||
|
this->z = other.z;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Explicitly, but easily, converts this Vector instance to one of the given type.
|
||||||
|
|
||||||
|
Vector3<float> u(0,0,0);
|
||||||
|
Vector3<double> v = u.cast<double>();
|
||||||
|
*/
|
||||||
|
template <class U>
|
||||||
|
Vector3<U> cast() const
|
||||||
|
{
|
||||||
|
return Vector3<U>( (U)x, (U)y, (U)z );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator==(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
return this->x == other.x && this->y == other.y && this->z==other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
return this->x!=other.x || this->y!=other.y || this->z!=other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator+(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
return Vector3<T>(this->x + other.x, this->y + other.y, this->z + other.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator+=(const Vector3<T>& other)
|
||||||
|
{
|
||||||
|
this->x+=other.x;
|
||||||
|
this->y+=other.y;
|
||||||
|
this->z+=other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator-() const
|
||||||
|
{
|
||||||
|
return Vector3<T>(-this->x, -this->y, -this->z);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator-(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
return Vector3<T>(this->x - other.x, this->y - other.y, this->z - other.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator-=(const Vector3<T>& other)
|
||||||
|
{
|
||||||
|
this->x-=other.x;
|
||||||
|
this->y-=other.y;
|
||||||
|
this->z-=other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator*(T s) const
|
||||||
|
{
|
||||||
|
return Vector3<T>(this->x*s, this->y*s, this->z*s);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator*=(T s)
|
||||||
|
{
|
||||||
|
this->x*=s;
|
||||||
|
this->y*=s;
|
||||||
|
this->z*=s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> operator/(T s) const
|
||||||
|
{
|
||||||
|
return Vector3<T>(this->x/s, this->y/s, this->z/s);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator/=(T s)
|
||||||
|
{
|
||||||
|
this->x/=s;
|
||||||
|
this->y/=s;
|
||||||
|
this->z/=s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector3<T> cross( const Vector3<T>& other ) const
|
||||||
|
{
|
||||||
|
return Vector3<T>(
|
||||||
|
this->y*other.z - this->z*other.y,
|
||||||
|
this->z*other.x - this->x*other.z,
|
||||||
|
this->x*other.y - this->y*other.x );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T dot( const Vector3<T>& other ) const
|
||||||
|
{
|
||||||
|
return this->x*other.x + this->y*other.y + this->z*other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T length() const
|
||||||
|
{
|
||||||
|
return( sqrt( this->x*this->x + this->y*this->y + this->z*this->z ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the square of the length of the vector.
|
||||||
|
|
||||||
|
Use this if you just want to compare legths of vectors, as this is faster to
|
||||||
|
compute than lenght()
|
||||||
|
*/
|
||||||
|
inline T length2() const
|
||||||
|
{
|
||||||
|
return this->x*this->x + this->y*this->y + this->z*this->z;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resizes the vector.
|
||||||
|
*/
|
||||||
|
inline void setLength(const T newLenght)
|
||||||
|
{
|
||||||
|
const T scale = ( newLenght / this->length() );
|
||||||
|
this->x *= scale;
|
||||||
|
this->y *= scale;
|
||||||
|
this->z *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline T distance(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
const T xDelta = this->x-other.x;
|
||||||
|
const T yDelta = this->y-other.y;
|
||||||
|
const T zDelta = this->z-other.z;
|
||||||
|
return sqrt( xDelta*xDelta + yDelta*yDelta + zDelta*zDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the square of the distance to the other vector
|
||||||
|
|
||||||
|
Use this if you just want to compare distances, as the square of
|
||||||
|
the distance is faster to compute than the distance itself.
|
||||||
|
*/
|
||||||
|
inline T distance2(const Vector3<T>& other) const
|
||||||
|
{
|
||||||
|
const T xDelta = this->x-other.x;
|
||||||
|
const T yDelta = this->y-other.y;
|
||||||
|
const T zDelta = this->z-other.z;
|
||||||
|
return xDelta*xDelta + yDelta*yDelta + zDelta*zDelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void normalize()
|
||||||
|
{
|
||||||
|
const T len = this->length();
|
||||||
|
this->x /= len;
|
||||||
|
this->y /= len;
|
||||||
|
this->z /= len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a normalized copy of the vector.
|
||||||
|
|
||||||
|
Use if you need a normalized version of the vector AND
|
||||||
|
the vector itself.
|
||||||
|
*/
|
||||||
|
inline Vector3<T> normalizedCopy()
|
||||||
|
{
|
||||||
|
Vector3<T> v = this;
|
||||||
|
const T len = v.length(); //inline normalize
|
||||||
|
v.x /= len;
|
||||||
|
v.y /= len;
|
||||||
|
v.z /= len;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rotateAroundY(T radians)
|
||||||
|
{
|
||||||
|
const double cs = cos(radians);
|
||||||
|
const double sn = sin(radians);
|
||||||
|
set((T)(x*cs - z*sn), y, (T)(x*sn + z*cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method will rotate the point represented by this vector
|
||||||
|
arround a given axis.
|
||||||
|
|
||||||
|
This is the most general form for the methods rotateAroundX,
|
||||||
|
Y and Z, but is more expensive.
|
||||||
|
|
||||||
|
\note the axis MUST be normalized
|
||||||
|
|
||||||
|
\note that the axis passes through the point (0,0,0).
|
||||||
|
|
||||||
|
Math from http://local.wasp.uwa.edu.au/~pbourke/geometry/rotate/
|
||||||
|
*/
|
||||||
|
inline void rotateAround(const Vector3<T>& axis, T radians)
|
||||||
|
{
|
||||||
|
T costheta = cos(radians);
|
||||||
|
T sintheta = sin(radians);
|
||||||
|
|
||||||
|
Vector3<T> q;
|
||||||
|
q.x = (costheta + (1 - costheta) * axis.x * axis.x) * this->x;
|
||||||
|
q.x += ((1 - costheta) * axis.x * axis.y - axis.z * sintheta) * this->y;
|
||||||
|
q.x += ((1 - costheta) * axis.x * axis.z + axis.y * sintheta) * this->z;
|
||||||
|
|
||||||
|
q.y = ((1 - costheta) * axis.x * axis.y + axis.z * sintheta) * this->x;
|
||||||
|
q.y += (costheta + (1 - costheta) * axis.y * axis.y) * this->y;
|
||||||
|
q.y += ((1 - costheta) * axis.y * axis.z - axis.x * sintheta) * this->z;
|
||||||
|
|
||||||
|
q.z = ((1 - costheta) * axis.x * axis.z - axis.y * sintheta) * this->x;
|
||||||
|
q.z += ((1 - costheta) * axis.y * axis.z + axis.x * sintheta) * this->y;
|
||||||
|
q.z += (costheta + (1 - costheta) * axis.z * axis.z) * this->z;
|
||||||
|
|
||||||
|
this->set(q);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rotateAround(const Vector3<T>& p1, const Vector3<T>& p2, T radians)
|
||||||
|
{
|
||||||
|
Vector3<T> r;
|
||||||
|
r.x = p2.x - p1.x;
|
||||||
|
r.y = p2.y - p1.y;
|
||||||
|
r.z = p2.z - p1.z;
|
||||||
|
this->x -= p1.x;
|
||||||
|
this->y -= p1.y;
|
||||||
|
this->z -= p1.z;
|
||||||
|
r.normalize();
|
||||||
|
|
||||||
|
T costheta, sintheta;
|
||||||
|
costheta = cos(radians);
|
||||||
|
sintheta = sin(radians);
|
||||||
|
|
||||||
|
Vector3<T> q;
|
||||||
|
q.x = (costheta + (1 - costheta) * r.x * r.x) * this->x;
|
||||||
|
q.x += ((1 - costheta) * r.x * r.y - r.z * sintheta) * this->y;
|
||||||
|
q.x += ((1 - costheta) * r.x * r.z + r.y * sintheta) * this->z;
|
||||||
|
|
||||||
|
q.y = ((1 - costheta) * r.x * r.y + r.z * sintheta) * this->x;
|
||||||
|
q.y += (costheta + (1 - costheta) * r.y * r.y) * this->y;
|
||||||
|
q.y += ((1 - costheta) * r.y * r.z - r.x * sintheta) * this->z;
|
||||||
|
|
||||||
|
q.z = ((1 - costheta) * r.x * r.z - r.y * sintheta) * this->x;
|
||||||
|
q.z += ((1 - costheta) * r.y * r.z + r.x * sintheta) * this->y;
|
||||||
|
q.z += (costheta + (1 - costheta) * r.z * r.z) * this->z;
|
||||||
|
|
||||||
|
q.x += p1.x;
|
||||||
|
q.y += p1.y;
|
||||||
|
q.z += p1.z;
|
||||||
|
|
||||||
|
this->set(q);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNaN() const
|
||||||
|
{
|
||||||
|
return x!=x || y!=y || z!=z;
|
||||||
|
}
|
||||||
|
|
||||||
|
T x;
|
||||||
|
T y;
|
||||||
|
T z;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Vector3<int> Vector3i;
|
||||||
|
typedef Vector3<float> Vector3f;
|
||||||
|
typedef Vector3<double> Vector3d;
|
||||||
|
|
||||||
|
#endif//VECTOR_3_H
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef DCEL_Vertex_h
|
||||||
|
#define DCEL_Vertex_h
|
||||||
|
|
||||||
|
//#include <cassert>
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class HalfEdgeT;
|
||||||
|
|
||||||
|
template<class VertexDataT, class HalfEdgeDataT, class FaceDataT>
|
||||||
|
class VertexT
|
||||||
|
{
|
||||||
|
typedef VertexT<VertexDataT, HalfEdgeDataT, FaceDataT> Vertex;
|
||||||
|
typedef HalfEdgeT<VertexDataT, HalfEdgeDataT, FaceDataT> HalfEdge;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
VertexT():
|
||||||
|
data(),
|
||||||
|
incidentEdge(NULL)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
inline HalfEdge* getIncidentEdge() const
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
return this->incidentEdge;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void setIncidentEdge(HalfEdge* edge)
|
||||||
|
{
|
||||||
|
//assert(this);
|
||||||
|
this->incidentEdge = edge;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline VertexDataT& getData()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const VertexDataT& getData() const
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
HalfEdge* incidentEdge;
|
||||||
|
VertexDataT data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif//DCEL_Vertex_h
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "WavefrontObjImporter.h"
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
void WavefrontObjLoader::load( const std::string& objFile )
|
||||||
|
{
|
||||||
|
vertices.clear();
|
||||||
|
verticeCount=0;
|
||||||
|
faces.clear();
|
||||||
|
faceCount=0;
|
||||||
|
|
||||||
|
std::ifstream stream;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stream.open( objFile.c_str(), std::ios::in );
|
||||||
|
if( stream )
|
||||||
|
{
|
||||||
|
// load the obj
|
||||||
|
while( stream.good() )
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
stream.getline(buffer, sizeof(buffer));
|
||||||
|
std::stringstream str(buffer);
|
||||||
|
std::string name;
|
||||||
|
str >> name;
|
||||||
|
if( name=="v" )
|
||||||
|
{
|
||||||
|
Vector3f position;
|
||||||
|
str >> position.x >> position.y >> position.z;
|
||||||
|
vertices.push_back( position );
|
||||||
|
verticeCount++;
|
||||||
|
}
|
||||||
|
else if( name=="f" )
|
||||||
|
{
|
||||||
|
unsigned int a, b, c;
|
||||||
|
str >> a >> b >> c;
|
||||||
|
faces.push_back(a-1);
|
||||||
|
faces.push_back(b-1);
|
||||||
|
faces.push_back(c-1);
|
||||||
|
faceCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw cpp::Exception("Can't open the file '"+objFile+"'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( const std::exception& e )
|
||||||
|
{
|
||||||
|
if( stream.is_open() )
|
||||||
|
stream.close();
|
||||||
|
std::cerr << e.what();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef WavefrontObjImporter_h
|
||||||
|
#define WavefrontObjImporter_h
|
||||||
|
|
||||||
|
#include "DCELStream.h"
|
||||||
|
#include "Vector3.h"
|
||||||
|
|
||||||
|
class WavefrontObjLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void load( const std::string& objFile );
|
||||||
|
|
||||||
|
std::list<Vector3f> vertices;
|
||||||
|
unsigned int verticeCount;
|
||||||
|
std::list<unsigned int> faces;
|
||||||
|
unsigned int faceCount;
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Class that imports a Wavefront OBJ file into a DCEL mesh.
|
||||||
|
|
||||||
|
It assumes that the mesh is totally triangulated.
|
||||||
|
*/
|
||||||
|
template <class MeshT>
|
||||||
|
class WavefrontObjImporter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
Loads from the given filename.
|
||||||
|
|
||||||
|
It just calls the 'import' method with the opened stream.
|
||||||
|
*/
|
||||||
|
void import( const std::string& objFile, MeshT& mesh);
|
||||||
|
|
||||||
|
void import( std::list<Vector3f>& vertices, unsigned int verticeCount, std::list<unsigned int>& faces, unsigned int faceCount, MeshT& mesh);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void WavefrontObjImporter<MeshT>::import( const std::string& objFilename, MeshT& mesh )
|
||||||
|
{
|
||||||
|
std::cerr << "Starting importing the file '" << objFilename << "'" << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "- loading the OBJ file" << std::endl;
|
||||||
|
WavefrontObjLoader loader;
|
||||||
|
loader.load(objFilename);
|
||||||
|
|
||||||
|
import(loader.vertices, loader.verticeCount, loader.faces, loader.faceCount, mesh);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MeshT>
|
||||||
|
void WavefrontObjImporter<MeshT>::import( std::list<Vector3f>& vertices, unsigned int verticeCount, std::list<unsigned int>& faces, unsigned int faceCount, MeshT& mesh)
|
||||||
|
{
|
||||||
|
// put it into the mesh
|
||||||
|
std::cerr << "- loading the DCEL mesh: " << std::endl;
|
||||||
|
std::cerr << " + " << verticeCount << " vertices" << std::endl;
|
||||||
|
mesh.clear();
|
||||||
|
mesh.getVertices().reserve(verticeCount);
|
||||||
|
mesh.getFaces().reserve(faceCount);
|
||||||
|
//mesh.getEdges().reserve( 2*(verticeCount+faceCount) ); // Euler: V – A + F = 2 --> A = V + F - 2
|
||||||
|
mesh.getHalfEdges().reserve( 2*(3*faceCount) ); // just a good expensive number of edges =)
|
||||||
|
std::list<Vector3f>::iterator vit = vertices.begin();
|
||||||
|
while( vit!=vertices.end() )
|
||||||
|
{
|
||||||
|
unsigned int id = mesh.createVertex();
|
||||||
|
mesh.getVertex(id)->getData().position = *vit;
|
||||||
|
vit++;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << " + " << faceCount << " faces" << std::endl;
|
||||||
|
std::list<unsigned int>::iterator fit = faces.begin();
|
||||||
|
unsigned int count=0;
|
||||||
|
while( fit!=faces.end() )
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
unsigned int a = *fit; ++fit;
|
||||||
|
unsigned int b = *fit; ++fit;
|
||||||
|
unsigned int c = *fit; ++fit;
|
||||||
|
unsigned int fid = mesh.createTriangularFace( a, b, c );
|
||||||
|
if (fid!=-1)
|
||||||
|
{
|
||||||
|
//std::cout << a << ' ' << b << ' ' << c << std::endl;
|
||||||
|
mesh.checkFace(fid);
|
||||||
|
mesh.checkAllFaces();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << " + " << mesh.getNumUnhandledTriangles() << " bad triangles" << std::endl;
|
||||||
|
mesh.manageUnhandledTriangles();
|
||||||
|
mesh.checkAllFaces();
|
||||||
|
|
||||||
|
std::cerr << "Done!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif//WavefrontObjImporter_h
|
||||||
+423
@@ -0,0 +1,423 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright Leonardo Fischer 2011 - http://coderender.blogspot.com
|
||||||
|
//
|
||||||
|
// Distributed under the licence available in the accompanying file
|
||||||
|
// LICENCE.txt. Please read it before use this code.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "DCEL/Mesh.h"
|
||||||
|
#include "DCEL/DCELStream.h"
|
||||||
|
#include "DCEL/WavefrontObjImporter.h"
|
||||||
|
#include "DCEL/Vector3.h"
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Here I'll define the three data structures that will be
|
||||||
|
associated with Vertices, half-edges and faces. Put anything you want
|
||||||
|
inside of it.
|
||||||
|
*/
|
||||||
|
class VertexData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VertexData()
|
||||||
|
{
|
||||||
|
this->x = 0;
|
||||||
|
this->y = 0;
|
||||||
|
this->z = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float x, y, z;
|
||||||
|
void setVerticeCoordinates(float x, float y)
|
||||||
|
{
|
||||||
|
this->x = x;
|
||||||
|
this->y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
If you need to save the stream to a file, rewrite the << operator for the
|
||||||
|
ostream class. The DCELStream class will use it to write to a file. More latter.
|
||||||
|
*/
|
||||||
|
friend std::ostream& operator <<(std::ostream &os, const VertexData& vertexData)
|
||||||
|
{
|
||||||
|
os << vertexData.x << " " << vertexData.y;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
If you save the mesh to a file, rewrite the operator >> to be able to load
|
||||||
|
the mesh latter using the DCELStream class.
|
||||||
|
*/
|
||||||
|
friend std::istream& operator >>(std::istream &is, VertexData& vertexData)
|
||||||
|
{
|
||||||
|
is >> vertexData.x >> vertexData.y;
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Another possible class to use within a vertex. In the current implementation of
|
||||||
|
the WavefrontObjImporter, I need the Vector3f class to load the vertices positions.
|
||||||
|
|
||||||
|
Of course, there should be another way to do this, but I didn't figured out.
|
||||||
|
If you have a suggestion, let me know =)
|
||||||
|
*/
|
||||||
|
class VertexDataWithPosition
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vector3f position;
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
class HalfEdgeData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HalfEdgeData() {
|
||||||
|
modified = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void modify() {
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isModified() const {
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator <<(std::ostream &os, const HalfEdgeData& halfEdgeData)
|
||||||
|
{
|
||||||
|
std::string modified = halfEdgeData.isModified()? "true" : "false";
|
||||||
|
os << modified;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend std::istream& operator >>(std::istream &is, HalfEdgeData& halfEdgeData)
|
||||||
|
{
|
||||||
|
std::string modified;
|
||||||
|
is >> modified;
|
||||||
|
|
||||||
|
if (modified.compare("true")==0)
|
||||||
|
{
|
||||||
|
halfEdgeData.modify();
|
||||||
|
}
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool modified;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FaceData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string colorName;
|
||||||
|
|
||||||
|
friend std::ostream& operator <<(std::ostream &os, const FaceData& faceData)
|
||||||
|
{
|
||||||
|
os << faceData.colorName;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend std::istream& operator >>(std::istream &is, FaceData& faceData)
|
||||||
|
{
|
||||||
|
is >> faceData.colorName;
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Now I will define the type MyMesh, which is a Mesh that each vertex, face and half-edge
|
||||||
|
has one object given as parameter here.
|
||||||
|
*/
|
||||||
|
typedef Mesh<VertexData, HalfEdgeData, FaceData> MyMesh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Another type of Mesh. In this type, each vertex will have an instance of
|
||||||
|
VertexDataWithPosition.
|
||||||
|
|
||||||
|
Although MyMesh and MyMeshUsingVector have the same structure, they are not
|
||||||
|
interchangeable. They are different objects! But you can use
|
||||||
|
the DCELStream::copyDcelData() method to convert between different mesh types.
|
||||||
|
*/
|
||||||
|
typedef Mesh<VertexDataWithPosition, HalfEdgeData, FaceData> MyMeshUsingVector;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method will create and initialize an hard-coded mesh.
|
||||||
|
*/
|
||||||
|
void createHardCodedMesh(MyMesh* mesh) {
|
||||||
|
|
||||||
|
// reserve the needed space for the mesh. These numbers came from the hardcoded structure :)
|
||||||
|
mesh->getVertices().reserve( 5 ); // we will put 5 vertices into the mesh
|
||||||
|
mesh->getHalfEdges().reserve( 16 ); //there are 8 edges on the figure. Each edge has 2 half-edges. So, 16
|
||||||
|
mesh->getFaces().reserve( 4 ); //4 faces
|
||||||
|
|
||||||
|
/**
|
||||||
|
Now, create the vertices. Each time I call createGetVertex here, a new vertex is created
|
||||||
|
and a pointer to it is returned. The first vertex has its ID equals to 0, the second equals
|
||||||
|
to 1, and so on.
|
||||||
|
|
||||||
|
If you call getData() on that pointer, you get a reference for the VertexData
|
||||||
|
object that is inside this vertex. The getData() works in the same way for
|
||||||
|
Half-Edge and Face pointers, returning a HalfEdgeData and FaceData object,
|
||||||
|
respectively.
|
||||||
|
*/
|
||||||
|
mesh->createGetVertex()->getData().setVerticeCoordinates( 10, 5 ); //vertex 0
|
||||||
|
mesh->createGetVertex()->getData().setVerticeCoordinates( 6, 10 ); //vertex 1
|
||||||
|
mesh->createGetVertex()->getData().setVerticeCoordinates( 15, 9 ); //vertex 2
|
||||||
|
mesh->createGetVertex()->getData().setVerticeCoordinates( 14, 1 ); //vertex 3
|
||||||
|
mesh->createGetVertex()->getData().setVerticeCoordinates( 2, 4 ); //vertex 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
Now we will create the faces using the IDs from the vertices created before. I'll
|
||||||
|
give the three vertices's IDs that represents each face. Again, the faces receive
|
||||||
|
an incremental ID starting from 0.
|
||||||
|
|
||||||
|
I must ensure that all faces are described in the same orientation (clock-wise or
|
||||||
|
counter-clock-wise). If I fail in this, I will receive very strange runtime errors.
|
||||||
|
*/
|
||||||
|
mesh->createTriangularFace( 0, 1, 2 );
|
||||||
|
mesh->createTriangularFace( 0, 2, 3 );
|
||||||
|
mesh->createTriangularFace( 0, 3, 4 );
|
||||||
|
mesh->createTriangularFace( 0, 4, 1 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is just a helper method that checks that all pointers are
|
||||||
|
set correctly. If I did anything wrong before, an exception will
|
||||||
|
be thrown.
|
||||||
|
*/
|
||||||
|
mesh->checkAllFaces();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Now I'll use the ID of each face to set a color on it.
|
||||||
|
*/
|
||||||
|
mesh->getFace(0)->getData().colorName = "red";
|
||||||
|
mesh->getFace(1)->getData().colorName = "green";
|
||||||
|
mesh->getFace(2)->getData().colorName = "blue";
|
||||||
|
mesh->getFace(3)->getData().colorName = "white";
|
||||||
|
|
||||||
|
/**
|
||||||
|
Now I'll modify some half edges using a iterator. This will iterate over
|
||||||
|
all half-edges that starts on the vertex 1. The iterator can run over all
|
||||||
|
the edges that starts on the given vertex or face.
|
||||||
|
*/
|
||||||
|
MyMesh::EdgeIterator iterator( mesh->getVertex(1) );
|
||||||
|
while(iterator.hasNext()) {
|
||||||
|
MyMesh::HalfEdge* halfEdge = iterator.getNext();
|
||||||
|
halfEdge->getData().modify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
And also, I'll modify the half-edge that starts on the vertex 0 and ends on
|
||||||
|
the vertex 3. The method getHalfEdge(unsigned int a, unsigned int b) returns the
|
||||||
|
half-edge that starts at 'a' and ends at 'b', or null if such connection does
|
||||||
|
not exists.
|
||||||
|
*/
|
||||||
|
MyMesh::HalfEdge* edge = mesh->getHalfEdge(3, 0);
|
||||||
|
if (edge!=NULL)
|
||||||
|
{
|
||||||
|
edge->getData().modify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveMesh(MyMesh* mesh, const char* filename)
|
||||||
|
{
|
||||||
|
if (mesh!=NULL)
|
||||||
|
{
|
||||||
|
std::ofstream outputFile;
|
||||||
|
outputFile.open(filename);
|
||||||
|
if (outputFile)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
This is where I will write the mesh to a file.
|
||||||
|
|
||||||
|
Note that the operator "<<" need to be rewrited on the VertexData,
|
||||||
|
HalfEdgeData and FaceData classes.
|
||||||
|
*/
|
||||||
|
DCELStream<MyMesh>::write(*mesh, outputFile);
|
||||||
|
|
||||||
|
outputFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadMesh(MyMesh* mesh, const char* filename)
|
||||||
|
{
|
||||||
|
if (mesh!=NULL)
|
||||||
|
{
|
||||||
|
std::ifstream inputFile;
|
||||||
|
inputFile.open(filename);
|
||||||
|
if (inputFile)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
This is where I load the mesh from a DCEL file, saved with the
|
||||||
|
DCELStream<MyMesh>::write() method.
|
||||||
|
|
||||||
|
As for the DCELStream<MyMesh>::write(), here you need to rewrite the
|
||||||
|
">>" operator on the VertexData, HalfEdgeData and FaceData classes.
|
||||||
|
*/
|
||||||
|
DCELStream<MyMesh>::read(*mesh, inputFile);
|
||||||
|
|
||||||
|
inputFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void doSomeStuffWithMesh(MyMesh* mesh)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
Print some basic information about the mesh.
|
||||||
|
*/
|
||||||
|
std::cout << "The mesh contain " << mesh->getNumFaces() << " faces." << std::endl;
|
||||||
|
std::cout << "The mesh contain " << mesh->getNumVertices() << " vertices." << std::endl;
|
||||||
|
std::cout << "The mesh contain " << mesh->getNumHalfEdges() << " half-edges. " <<
|
||||||
|
"This number is 2 times the number of edges." << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Show the ID of the neighbor vertices of the vertex 4. It will get each half-edge
|
||||||
|
that starts at the vertex 4, get its twin half-edge, and get the origin of the twin
|
||||||
|
half-edge.
|
||||||
|
|
||||||
|
The method getVertexId() returns the id of a given vertex. There are similar vertices
|
||||||
|
for half-edges and faces
|
||||||
|
*/
|
||||||
|
std::cout << "The neighbors of the vertex 4 are: ";
|
||||||
|
MyMesh::Vertex * vertex = mesh->getVertex(4);
|
||||||
|
MyMesh::EdgeIterator iterator(vertex);
|
||||||
|
while(iterator.hasNext()) {
|
||||||
|
MyMesh::Vertex* neighborVertex = iterator.getNext()->getTwin()->getOrigin();
|
||||||
|
std::cout << mesh->getVertexId(neighborVertex) << ", ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Iterate over the edges that composes the face 1 (the one composed by
|
||||||
|
the vertices 0, 2, 3). For each edge, will show its start vertex ID,
|
||||||
|
its ending vertex ID (which is the origin of its twin), and show if
|
||||||
|
it was modified (remember that I called modify() on the half-edge that
|
||||||
|
starts on vertex 3 and ends on vertex 0, see createHardCodedMesh() ).
|
||||||
|
*/
|
||||||
|
std::cout << "The half-edges of the face 1 are: ";
|
||||||
|
MyMesh::Face* face = mesh->getFace(1);
|
||||||
|
iterator.reset(face); //now the iterator will run over the edges of the face
|
||||||
|
while ( iterator.hasNext() )
|
||||||
|
{
|
||||||
|
MyMesh::HalfEdge* halfEdge = iterator.getNext();
|
||||||
|
std::cout << "[id="<< mesh->getHalfEdgeId(halfEdge) <<
|
||||||
|
" origin=" << mesh->getVertexId( halfEdge->getOrigin() ) <<
|
||||||
|
" end=" << mesh->getVertexId( halfEdge->getTwin()->getOrigin() ) <<
|
||||||
|
" modified=" << (halfEdge->getData().isModified()?"true":"false") << "], ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Iterate over all faces that the mesh have, showing its color. It is possible
|
||||||
|
to iterate over the half-edges and faces in the same way.
|
||||||
|
*/
|
||||||
|
std::cout << "The faces are: ";
|
||||||
|
for (unsigned int i=0; i<mesh->getNumFaces(); ++i)
|
||||||
|
{
|
||||||
|
MyMesh::Face* face = mesh->getFace(i);
|
||||||
|
std::cout << "[id=" << mesh->getFaceId(face) << " color=" << face->getData().colorName << "], ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void importWavefrontObjFile(MyMeshUsingVector* mesh, const char* filename)
|
||||||
|
{
|
||||||
|
WavefrontObjImporter<MyMeshUsingVector> importer;
|
||||||
|
importer.import(filename, *mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void convertBetweenMeshes(MyMeshUsingVector* meshUsingVector, MyMesh* mesh)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
This will create on the 'mesh' the same structure of 'meshUsingVector'.
|
||||||
|
Note that only the DCEL connectivity is copied.
|
||||||
|
*/
|
||||||
|
DCELStream<MyMeshUsingVector>::copyDcelData(*meshUsingVector, *mesh);
|
||||||
|
|
||||||
|
/**
|
||||||
|
As the IDs of faces, half-edges and vertices are the same in both meshes,
|
||||||
|
it is possible to use this fact to convert internal data from one structure
|
||||||
|
to the other.
|
||||||
|
|
||||||
|
Of course, there should be a better way to do this automatically in the
|
||||||
|
copyDcelData() method, but I had no time to implement it =(
|
||||||
|
*/
|
||||||
|
for (unsigned int i=0;i<meshUsingVector->getNumVertices(); ++i)
|
||||||
|
{
|
||||||
|
MyMeshUsingVector::Vertex* originVertex = meshUsingVector->getVertex(i);
|
||||||
|
MyMesh::Vertex* targetVertex = mesh->getVertex(i);
|
||||||
|
targetVertex->getData().x = originVertex->getData().position.x;
|
||||||
|
targetVertex->getData().y = originVertex->getData().position.y;
|
||||||
|
targetVertex->getData().z = originVertex->getData().position.z;
|
||||||
|
}
|
||||||
|
for (unsigned int i=0;i<meshUsingVector->getNumHalfEdges(); ++i)
|
||||||
|
{
|
||||||
|
MyMeshUsingVector::HalfEdge* originHalfEdge = meshUsingVector->getHalfEdge(i);
|
||||||
|
MyMesh::HalfEdge* targetHalfEdge = mesh->getHalfEdge(i);
|
||||||
|
if (originHalfEdge->getData().isModified())
|
||||||
|
{
|
||||||
|
targetHalfEdge->getData().modify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (unsigned int i=0;i<meshUsingVector->getNumFaces(); ++i)
|
||||||
|
{
|
||||||
|
MyMesh::Face* targetFace = mesh->getFace(i);
|
||||||
|
targetFace->getData().colorName = "yellow";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
Creates a new, hard coded mesh, and save it to a file.
|
||||||
|
*/
|
||||||
|
MyMesh* mesh = new MyMesh();
|
||||||
|
createHardCodedMesh(mesh);
|
||||||
|
saveMesh(mesh, "hard-coded-mesh.dcel");
|
||||||
|
delete mesh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a new, empty mesh, and fill it with the data from
|
||||||
|
the file saved before. Also, print some stuff about it
|
||||||
|
on the console.
|
||||||
|
*/
|
||||||
|
mesh = new MyMesh(); //create a new, empty mesh
|
||||||
|
loadMesh(mesh, "hard-coded-mesh.dcel");
|
||||||
|
doSomeStuffWithMesh(mesh);
|
||||||
|
delete mesh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates another type of mesh (using my Vector3 class). Then, import a .OBJ
|
||||||
|
file into it. Finally, convert that mesh to the MyMesh data structure.
|
||||||
|
|
||||||
|
The method checkAllFaces() just ensures that everything is ok =)
|
||||||
|
*/
|
||||||
|
MyMeshUsingVector* meshUsingVect = new MyMeshUsingVector();
|
||||||
|
mesh = new MyMesh();
|
||||||
|
importWavefrontObjFile(meshUsingVect, "sphere.obj");
|
||||||
|
convertBetweenMeshes(meshUsingVect, mesh);
|
||||||
|
mesh->checkAllFaces();
|
||||||
|
meshUsingVect->checkAllFaces();
|
||||||
|
delete meshUsingVect;
|
||||||
|
delete mesh;
|
||||||
|
|
||||||
|
system("pause");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "An exception occurred: " << e.what() << std::endl;
|
||||||
|
system("pause");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
RPly 1.01 license
|
||||||
|
Copyright © 2003-2005 Diego Nehab.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "rply.h"
|
||||||
|
|
||||||
|
/* internal function prototypes */
|
||||||
|
static void error(const char *fmt, ...);
|
||||||
|
static void help(void);
|
||||||
|
static void parse_arguments(int argc, char **argv,
|
||||||
|
e_ply_storage_mode *storage_mode,
|
||||||
|
const char **iname, const char **oname);
|
||||||
|
static void setup_callbacks(p_ply iply, p_ply oply);
|
||||||
|
|
||||||
|
/* given a format mode, an input file name and an output file name,
|
||||||
|
* convert input file to output in given format mode */
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
const char *value = NULL;
|
||||||
|
e_ply_storage_mode storage_mode = PLY_LITTLE_ENDIAN;
|
||||||
|
const char *iname = NULL, *oname = NULL;
|
||||||
|
p_ply iply = NULL, oply = NULL;
|
||||||
|
/* parse command line arguments */
|
||||||
|
parse_arguments(argc, argv, &storage_mode, &iname, &oname);
|
||||||
|
/* open input file and make sure we parsed its header */
|
||||||
|
iply = ply_open(iname, NULL);
|
||||||
|
if (!iply) error("Unable to open file '%s'", iname);
|
||||||
|
if (!ply_read_header(iply)) error("Failed reading '%s' header", iname);
|
||||||
|
/* create output file */
|
||||||
|
oply = ply_create(oname, storage_mode, NULL);
|
||||||
|
if (!oply) error("Unable to create file '%s'", oname);
|
||||||
|
/* create elements and properties in output file and
|
||||||
|
* setup callbacks for them in input file */
|
||||||
|
setup_callbacks(iply, oply);
|
||||||
|
/* pass comments and obj_infos from input to output */
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_comment(iply, value)))
|
||||||
|
if (!ply_add_comment(oply, value))
|
||||||
|
error("Failed adding comments");
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_obj_info(iply, value)))
|
||||||
|
if (!ply_add_obj_info(oply, value))
|
||||||
|
error("Failed adding comments");
|
||||||
|
/* write output header */
|
||||||
|
if (!ply_write_header(oply)) error("Failed writing '%s' header", oname);
|
||||||
|
/* read input file generating callbacks that pass data to output file */
|
||||||
|
if (!ply_read(iply)) error("Conversion failed");
|
||||||
|
/* close up, we are done */
|
||||||
|
if (!ply_close(iply)) error("Error closing file '%s'", iname);
|
||||||
|
if (!ply_close(oply)) error("Error closing file '%s'", oname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prints an error message and exits */
|
||||||
|
static void error(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prints the help message and exits */
|
||||||
|
static void help(void)
|
||||||
|
{
|
||||||
|
error("Usage:\n"
|
||||||
|
" convert <option> <input> <output>\n"
|
||||||
|
"Options:\n"
|
||||||
|
" -a, --ascii: convert to ascii format\n"
|
||||||
|
" -b, --big-endian: convert to big-endian format\n"
|
||||||
|
" -l, --little-endian: convert to little-endian format\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* parse command line parameters */
|
||||||
|
static void parse_arguments(int argc, char **argv,
|
||||||
|
e_ply_storage_mode *storage_mode,
|
||||||
|
const char **iname, const char **oname)
|
||||||
|
{
|
||||||
|
if (argc < 4) help();
|
||||||
|
if (strcmp(argv[1], "--ascii") == 0 ||
|
||||||
|
strcmp(argv[1], "-a") == 0)
|
||||||
|
*storage_mode = PLY_ASCII;
|
||||||
|
else if (strcmp(argv[1], "--little-endian") == 0 ||
|
||||||
|
strcmp(argv[1], "-l") == 0)
|
||||||
|
*storage_mode = PLY_LITTLE_ENDIAN;
|
||||||
|
else if (strcmp(argv[1], "--big-endian") == 0 ||
|
||||||
|
strcmp(argv[1], "-b") == 0)
|
||||||
|
*storage_mode = PLY_BIG_ENDIAN;
|
||||||
|
else help();
|
||||||
|
*iname = argv[2];
|
||||||
|
*oname = argv[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read callback */
|
||||||
|
static int callback(p_ply_argument argument)
|
||||||
|
{
|
||||||
|
void *pdata;
|
||||||
|
/* just pass the value from the input file to the output file */
|
||||||
|
ply_get_argument_user_data(argument, &pdata, NULL);
|
||||||
|
ply_write((p_ply) pdata, ply_get_argument_value(argument));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prepares the conversion */
|
||||||
|
static void setup_callbacks(p_ply iply, p_ply oply)
|
||||||
|
{
|
||||||
|
p_ply_element element = NULL;
|
||||||
|
/* iterate over all elements in input file */
|
||||||
|
while ((element = ply_get_next_element(iply, element))) {
|
||||||
|
p_ply_property property = NULL;
|
||||||
|
long ninstances = 0;
|
||||||
|
const char *element_name;
|
||||||
|
ply_get_element_info(element, &element_name, &ninstances);
|
||||||
|
/* add this element to output file */
|
||||||
|
if (!ply_add_element(oply, element_name, ninstances))
|
||||||
|
error("Unable to add output element '%s'", element_name);
|
||||||
|
/* iterate over all properties of current element */
|
||||||
|
while ((property = ply_get_next_property(element, property))) {
|
||||||
|
const char *property_name;
|
||||||
|
e_ply_type type, length_type, value_type;
|
||||||
|
ply_get_property_info(property, &property_name, &type,
|
||||||
|
&length_type, &value_type);
|
||||||
|
/* setup input callback for this property */
|
||||||
|
if (!ply_set_read_cb(iply, element_name, property_name, callback,
|
||||||
|
oply, 0))
|
||||||
|
error("Unable to setup input callback for property '%s'",
|
||||||
|
property_name);
|
||||||
|
/* add this property to output file */
|
||||||
|
if (!ply_add_property(oply, property_name, type, length_type,
|
||||||
|
value_type))
|
||||||
|
error("Unable to add output property '%s'", property_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "rply.h"
|
||||||
|
|
||||||
|
static int vertex_cb(p_ply_argument argument) {
|
||||||
|
long eol;
|
||||||
|
ply_get_argument_user_data(argument, NULL, &eol);
|
||||||
|
printf("%g", ply_get_argument_value(argument));
|
||||||
|
if (eol) printf("\n");
|
||||||
|
else printf(" ");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int face_cb(p_ply_argument argument) {
|
||||||
|
long length, value_index;
|
||||||
|
ply_get_argument_property(argument, NULL, &length, &value_index);
|
||||||
|
switch (value_index) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
printf("%g ", ply_get_argument_value(argument));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
printf("%g\n", ply_get_argument_value(argument));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
long nvertices, ntriangles;
|
||||||
|
p_ply ply = ply_open("input.ply", NULL);
|
||||||
|
if (!ply) return 1;
|
||||||
|
if (!ply_read_header(ply)) return 1;
|
||||||
|
nvertices = ply_set_read_cb(ply, "vertex", "x", vertex_cb, NULL, 0);
|
||||||
|
ply_set_read_cb(ply, "vertex", "y", vertex_cb, NULL, 0);
|
||||||
|
ply_set_read_cb(ply, "vertex", "z", vertex_cb, NULL, 1);
|
||||||
|
ntriangles = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, NULL, 0);
|
||||||
|
printf("%ld\n%ld\n", nvertices, ntriangles);
|
||||||
|
if (!ply_read(ply)) return 1;
|
||||||
|
ply_close(ply);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
ply
|
||||||
|
format ascii 1.0
|
||||||
|
comment this is our first comment
|
||||||
|
element vertex 3
|
||||||
|
property float x
|
||||||
|
property float y
|
||||||
|
property float z
|
||||||
|
element face 1
|
||||||
|
property list uchar int vertex_indices
|
||||||
|
comment this is our last comment
|
||||||
|
end_header
|
||||||
|
-1 0 0
|
||||||
|
000 1 0
|
||||||
|
1 0000 0
|
||||||
|
3 1 00000 2
|
||||||
|
3 1 0 2
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "rply.h"
|
||||||
|
|
||||||
|
static int callback(p_ply_argument argument)
|
||||||
|
{
|
||||||
|
void *pdata;
|
||||||
|
/* just pass the value from the input file to the output file */
|
||||||
|
ply_get_argument_user_data(argument, &pdata, NULL);
|
||||||
|
ply_write((p_ply) pdata, ply_get_argument_value(argument));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int setup_callbacks(p_ply iply, p_ply oply)
|
||||||
|
{
|
||||||
|
p_ply_element element = NULL;
|
||||||
|
/* iterate over all elements in input file */
|
||||||
|
while ((element = ply_get_next_element(iply, element))) {
|
||||||
|
p_ply_property property = NULL;
|
||||||
|
long nelems = 0;
|
||||||
|
const char *element_name;
|
||||||
|
ply_get_element_info(element, &element_name, &nelems);
|
||||||
|
/* add this element to output file */
|
||||||
|
if (!ply_add_element(oply, element_name, nelems)) return 0;
|
||||||
|
/* iterate over all properties of current element */
|
||||||
|
while ((property = ply_get_next_property(element, property))) {
|
||||||
|
const char *property_name;
|
||||||
|
e_ply_type type, length_type, value_type;
|
||||||
|
ply_get_property_info(property, &property_name, &type,
|
||||||
|
&length_type, &value_type);
|
||||||
|
/* setup input callback for this property */
|
||||||
|
if (!ply_set_read_cb(iply, element_name, property_name, callback,
|
||||||
|
oply, 0)) return 0;
|
||||||
|
/* add this property to output file */
|
||||||
|
if (!ply_add_property(oply, property_name, type, length_type,
|
||||||
|
value_type)) return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
const char *value;
|
||||||
|
p_ply iply, oply;
|
||||||
|
iply = ply_open("input.ply", NULL);
|
||||||
|
if (!iply) return 1;
|
||||||
|
if (!ply_read_header(iply)) return 1;
|
||||||
|
oply = ply_create("output.ply", PLY_LITTLE_ENDIAN, NULL);
|
||||||
|
if (!oply) return 1;
|
||||||
|
if (!setup_callbacks(iply, oply)) return 1;
|
||||||
|
/* pass comments and obj_infos from input to output */
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_comment(iply, value)))
|
||||||
|
if (!ply_add_comment(oply, value)) return 1;
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_obj_info(iply, value)))
|
||||||
|
if (!ply_add_obj_info(oply, value)) return 1;;
|
||||||
|
/* write output header */
|
||||||
|
if (!ply_write_header(oply)) return 1;
|
||||||
|
/* read input file generating callbacks that pass data to output file */
|
||||||
|
if (!ply_read(iply)) return 1;
|
||||||
|
/* close up, we are done */
|
||||||
|
if (!ply_close(iply)) return 1;
|
||||||
|
if (!ply_close(oply)) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,993 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta name="description" content="The RPly Homepage">
|
||||||
|
<meta name="keywords" content="open source, C, Library, PLY, file format,
|
||||||
|
input, output, tools">
|
||||||
|
<title>
|
||||||
|
RPly: ANSI C library for PLY file format input and output
|
||||||
|
</title>
|
||||||
|
<link rel="stylesheet" href="reference.css" type="text/css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<div class=header>
|
||||||
|
<hr>
|
||||||
|
<center>
|
||||||
|
<table summary="RPly logo">
|
||||||
|
<tr><td align=center>
|
||||||
|
<img border=0 alt="RPly" src="rply.png">
|
||||||
|
</td></tr>
|
||||||
|
<tr><td align=center valign=top>ANSI C Library for PLY file format input and output
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Introduction +++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<h1>Introduction</h1>
|
||||||
|
|
||||||
|
<p>RPly is a library that lets applications read and write PLY files. The
|
||||||
|
PLY file format is widely used to store geometric information, such as 3D
|
||||||
|
models, but is general enough to be useful for other purposes.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>There are other libraries out there, of course. I tried using them and
|
||||||
|
finally decided to write my own. I tried to write it in such a way that
|
||||||
|
others won't have to do it again and again. Everything that made me unhappy
|
||||||
|
about the existing libraries was eliminated from RPly.</p>
|
||||||
|
|
||||||
|
<p>RPly is easy to use, well documented, small, free,
|
||||||
|
open-source, ANSI C, efficient, and well tested. I will keep supporting it
|
||||||
|
for a while because all my tools use the library for input/output. The highlights are: </p>
|
||||||
|
<ul>
|
||||||
|
<li> A callback mechanism that makes PLY file input straightforward;
|
||||||
|
<li> Support for the full range of numeric formats though the user only
|
||||||
|
deals with doubles;
|
||||||
|
<li> Binary (big and little endian) and text modes are fully supported;
|
||||||
|
<li> Input and output are buffered for efficiency;
|
||||||
|
<li> Available under the
|
||||||
|
<a href=http://www.opensource.org/licenses/mit-license.html>MIT license</a>
|
||||||
|
for added freedom.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The format was developed at <a
|
||||||
|
href=http://graphics.stanford.edu/data/3Dscanrep/>Stanford University</a>
|
||||||
|
for use with their 3D scanning projects. Greg Turk's PLY library, available
|
||||||
|
from <a href=http://www.cc.gatech.edu/projects/large_models>
|
||||||
|
Georgia Institute of Technology</a>, seems to be the standard reference
|
||||||
|
to the PLY file format, although there are some variations out there.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p> Whatever documentation and examples were found, were taken into
|
||||||
|
consideration to create RPly. In theory, since RPly doesn't try to interpret
|
||||||
|
the meaning of the data in a PLY file, it should be able to read any PLY file.
|
||||||
|
In practice, the library works with all PLY files that I could find. </p>
|
||||||
|
|
||||||
|
<h2>Download</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Version 1.01 of RPly is available for download in source
|
||||||
|
code from <a href=rply-1.01.tar.gz>this link</a>. Examples and documentation
|
||||||
|
are packed inside the tar ball. Have fun!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Copyright © 2003-2005 Diego Nehab. All rights reserved. <br>
|
||||||
|
Author: <A href="http://www.cs.princeton.edu/~diego">Diego Nehab</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2>What's new?</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The change for version 1.01 is the use of our own buffering code when
|
||||||
|
reading ASCII files. Speedup factor of 5 in Linux, almost no change in
|
||||||
|
Windows.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2> RPly's idea of what a PLY file is </h2>
|
||||||
|
|
||||||
|
<p> A PLY file contains the description of one object. This object is
|
||||||
|
composed by <em>elements</em>, each element type
|
||||||
|
being composed by a group of <em>properties</em>. The PLY file
|
||||||
|
format specifies a syntax for the description of element types and the
|
||||||
|
properties that compose them, as well as comments and meta-information.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p> The element type descriptions come in a header, which is followed by
|
||||||
|
element instances. Element instances come grouped by their type, in the
|
||||||
|
order of declaration. Each element instance is defined by the value
|
||||||
|
of its properties. Properties values also appear in the order of their
|
||||||
|
declaration. Here is a sample PLY file describing a triangle: </p>
|
||||||
|
|
||||||
|
<pre class=example>
|
||||||
|
ply
|
||||||
|
format ascii 1.0
|
||||||
|
comment this is a simple file
|
||||||
|
obj_info any data, in one line of free form text
|
||||||
|
element vertex 3
|
||||||
|
property float x
|
||||||
|
property float y
|
||||||
|
property float z
|
||||||
|
element face 1
|
||||||
|
property list uchar int vertex_indices
|
||||||
|
end_header
|
||||||
|
-1 0 0
|
||||||
|
0 1 0
|
||||||
|
1 0 0
|
||||||
|
3 0 1 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p> The header goes from the first line to the line marked by
|
||||||
|
<tt>end_header</tt>. The first line contains only <tt>ply\n</tt> and is
|
||||||
|
used to detect whether a file is in PLY format or not. The second line
|
||||||
|
specifies the <tt>format</tt> number (which is always <tt>1.0</tt>) and the
|
||||||
|
storage mode (<tt>ascii</tt>, <tt>binary_big_endian</tt> or
|
||||||
|
<tt>binary_little_endian</tt>). </p>
|
||||||
|
|
||||||
|
<p> Lines that start with <tt>comment</tt> are just comments, of course.
|
||||||
|
Lines that start with <tt>obj_info</tt> contain meta-information about the
|
||||||
|
object. <tt>Comment</tt>s and <tt>obj_info</tt>s are optional and their
|
||||||
|
relative order in the header is irrelevant. </p>
|
||||||
|
|
||||||
|
<p> In the sample PLY file, the first element type is declared with name
|
||||||
|
<tt>vertex</tt>, and on the same line we learn that there will be 3
|
||||||
|
instances of this element type. The properties following describe what a
|
||||||
|
<tt>vertex</tt> element looks like. Each <tt>vertex</tt> is declared to
|
||||||
|
consist of 3 scalar properties, named <tt>x</tt>, <tt>y</tt> and
|
||||||
|
<tt>z</tt>. Each scalar property is declared to be of type <tt>float</tt>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p> Scalar types can be any of the following: <tt>int8</tt>,
|
||||||
|
<tt>uint8</tt>, <tt>int16</tt>, <tt>uint16</tt>, <tt>int32</tt>,
|
||||||
|
<tt>uint32</tt>, <tt>float32</tt>, <tt>float64</tt>, <tt>char</tt>,
|
||||||
|
<tt>uchar</tt>, <tt>short</tt>, <tt>ushort</tt>, <tt>int</tt>,
|
||||||
|
<tt>uint</tt>, <tt>float</tt>, <tt>double</tt>. They consist of signed
|
||||||
|
and unsigned integer types of sizes 8, 16 and 32 bits, as well as floating
|
||||||
|
point types of 32 and 64bits.
|
||||||
|
|
||||||
|
<p> Next, the <tt>face</tt> element type is declared, of which only 1
|
||||||
|
instance will be given. This element consists of a <tt>list</tt> property,
|
||||||
|
named <tt>vertex_indices</tt>. Lists are sequences on which the
|
||||||
|
first value, the <em>length</em>, gives the number of remaining values. List properties are described by the scalar
|
||||||
|
type of their length field and the scalar type of the remaining fields.
|
||||||
|
In the case of <tt>vertex_indices</tt>, the length field
|
||||||
|
is of type <tt>uchar</tt> and the remaining values are of type
|
||||||
|
<tt>int</tt>. </p>
|
||||||
|
|
||||||
|
<p> Following the header, come the elements, in the order they were
|
||||||
|
declared in the header. First come the 3 elements of type <tt>vertex</tt>,
|
||||||
|
each represented by the value of their properties <tt>x</tt>, <tt>y</tt>
|
||||||
|
and <tt>z</tt>. Then comes the single <tt>face</tt> element, composed by a
|
||||||
|
single list of type <tt>vertex_indices</tt> containing 3 values
|
||||||
|
(0 1 2).</p>
|
||||||
|
|
||||||
|
<h2> How to read a file with RPly </h2>
|
||||||
|
|
||||||
|
<p> Most users that want to read a PLY file already know which elements and
|
||||||
|
properties they are interested at. In the following example, we will
|
||||||
|
implement a simple program that dumps the contents of a PLY file to the
|
||||||
|
terminal, in a different, simpler format that only works for triangles.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p> This simple format has a header that gives the number of vertices in the
|
||||||
|
first line and the number of triangles in the second line. Following the
|
||||||
|
header come the vertices, and finally the triangles. Here is the sample
|
||||||
|
code for the program:</p>
|
||||||
|
|
||||||
|
<pre class=example>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "rply.h"
|
||||||
|
|
||||||
|
static int vertex_cb(p_ply_argument argument) {
|
||||||
|
long eol;
|
||||||
|
ply_get_argument_user_data(argument, NULL, &eol);
|
||||||
|
printf("%g", ply_get_argument_value(argument));
|
||||||
|
if (eol) printf("\n");
|
||||||
|
else printf(" ");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int face_cb(p_ply_argument argument) {
|
||||||
|
long length, value_index;
|
||||||
|
ply_get_argument_property(argument, NULL, &length, &value_index);
|
||||||
|
switch (value_index) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
printf("%g ", ply_get_argument_value(argument));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
printf("%g\n", ply_get_argument_value(argument));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
long nvertices, ntriangles;
|
||||||
|
p_ply ply = ply_open("input.ply", NULL);
|
||||||
|
if (!ply) return 1;
|
||||||
|
if (!ply_read_header(ply)) return 1;
|
||||||
|
nvertices = ply_set_read_cb(ply, "vertex", "x", vertex_cb, NULL, 0);
|
||||||
|
ply_set_read_cb(ply, "vertex", "y", vertex_cb, NULL, 0);
|
||||||
|
ply_set_read_cb(ply, "vertex", "z", vertex_cb, NULL, 1);
|
||||||
|
ntriangles = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, NULL, 0);
|
||||||
|
printf("%ld\n%ld\n", nvertices, ntriangles);
|
||||||
|
if (!ply_read(ply)) return 1;
|
||||||
|
ply_close(ply);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p> RPly uses callbacks to pass data to an application. Independent callbacks
|
||||||
|
can be associated with each property of each element. For scalar
|
||||||
|
properties, the callback is invoked once for each instance. For list
|
||||||
|
properties, the callback is invoked first with the number of
|
||||||
|
entries in the instance, and then once for each of the data entries.
|
||||||
|
<em>This is exactly the order in which the data items appear in the
|
||||||
|
file.</em></p>
|
||||||
|
|
||||||
|
<p> To keep things simple, values are always passed as <tt>double</tt>,
|
||||||
|
regardless of how they are stored in the file. From its parameters,
|
||||||
|
callbacks can find out exactly which part of the file is being processed
|
||||||
|
(including the real type of the value), plus access custom information
|
||||||
|
provided by the user in the form of a pointer and an integer constant. </p>
|
||||||
|
|
||||||
|
<p> In our example, we start with a call to <tt>ply_open</tt> to open a
|
||||||
|
file for reading. Then we get RPly to parse it's header, with a call to
|
||||||
|
<tt>ply_read_header</tt>. After the header is parsed, RPly knows which
|
||||||
|
element types and properties are available. We then set callbacks for each
|
||||||
|
of the <tt>vertex</tt> element properties and the <tt>face</tt> property
|
||||||
|
(using <tt>ply_set_read_cb</tt>). Finally, we invoke the main RPly reading
|
||||||
|
function, <tt>ply_read</tt>. This function reads all data in the file,
|
||||||
|
passing the data to the appropriate callbacks. After all reading is done,
|
||||||
|
we call <tt>ply_close</tt> to release any resources used by RPly.</p>
|
||||||
|
|
||||||
|
<p>There are some details, of course. <tt>Ply_set_read_cb</tt> returns the
|
||||||
|
number of instances of the target property (which is the same as the number
|
||||||
|
of element instances). This is how the program obtains the number of
|
||||||
|
vertices and faces in the file. </p>
|
||||||
|
|
||||||
|
<p>RPly lets us associate one pointer <em>and</em> one integer to each
|
||||||
|
callback. We are free to use either or both to link some context to our
|
||||||
|
callbacks. Our example uses the integer placeholder to tell
|
||||||
|
<tt>vertex_cb</tt> that it has to break the line after the <tt>z</tt>
|
||||||
|
property (notice the last argument of <tt>ply_set_read_cb</tt>).</p>
|
||||||
|
|
||||||
|
<p><tt>Vertex_cb</tt> gets the user data and the property value from it's
|
||||||
|
argument and prints accordingly. The <tt>face_cb</tt> callback is a bit
|
||||||
|
more complicated because lists are more complicated. Since the
|
||||||
|
simple file format only supports triangles, it only prints the first
|
||||||
|
3 list values, after which it breaks the line. </p>
|
||||||
|
|
||||||
|
<p> The output of the program, as expected, is: </p>
|
||||||
|
|
||||||
|
<pre class=example>
|
||||||
|
3
|
||||||
|
1
|
||||||
|
-1 0 0
|
||||||
|
0 1 0
|
||||||
|
1 0 0
|
||||||
|
0 1 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h2> Writing files with RPly </h2>
|
||||||
|
|
||||||
|
<p> The next example is somewhat more involved. We will create a program
|
||||||
|
that converts our simple PLY file to binary mode. Besides showing how to
|
||||||
|
write a PLY file, this example also illustrates the query functions. We
|
||||||
|
do not know a priori which elements and properties, comments and obj_infos
|
||||||
|
will be in the input file, so we need a way to find out. Although our simple
|
||||||
|
program would work on any PLY file, a better version of this program is
|
||||||
|
available from the RPly distribution. For simplicity, the simple version
|
||||||
|
omits error messages and command line parameter processing. </p>
|
||||||
|
|
||||||
|
<p> In practice, writing a file is even easier than reading one. First we
|
||||||
|
create a file in binary mode, with a call to <tt>ply_create</tt> (notice
|
||||||
|
the argument <tt>PLY_LITTLE_ENDIAN</tt> that gives the storage mode). Then,
|
||||||
|
we define the elements using <tt>ply_add_element</tt>. After each element, we
|
||||||
|
define its properties using <tt>ply_add_scalar_property</tt> or
|
||||||
|
<tt>ply_add_list_property</tt>. When we are done with elements and
|
||||||
|
properties, we add comments and obj_infos. We then write the header with
|
||||||
|
<tt>ply_write_header</tt> and send all data items. The data items are sent
|
||||||
|
one by one, with calls to <tt>ply_write</tt>, <em>in the same order they
|
||||||
|
are to appear in the file</em>. Again, to simplify things, this function
|
||||||
|
receives data as <tt>double</tt> and performs the needed conversion. Here
|
||||||
|
is the code for the example: </p>
|
||||||
|
|
||||||
|
<pre class=example>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "rply.h"
|
||||||
|
|
||||||
|
static int callback(p_ply_argument argument) {
|
||||||
|
void *pdata;
|
||||||
|
/* just pass the value from the input file to the output file */
|
||||||
|
ply_get_argument_user_data(argument, &pdata, NULL);
|
||||||
|
ply_write((p_ply) pdata, ply_get_argument_value(argument));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int setup_callbacks(p_ply iply, p_ply oply) {
|
||||||
|
p_ply_element element = NULL;
|
||||||
|
/* iterate over all elements in input file */
|
||||||
|
while ((element = ply_get_next_element(iply, element))) {
|
||||||
|
p_ply_property property = NULL;
|
||||||
|
long ninstances = 0;
|
||||||
|
const char *element_name;
|
||||||
|
ply_get_element_info(element, &element_name, &ninstances);
|
||||||
|
/* add this element to output file */
|
||||||
|
if (!ply_add_element(oply, element_name, ninstances)) return 0;
|
||||||
|
/* iterate over all properties of current element */
|
||||||
|
while ((property = ply_get_next_property(element, property))) {
|
||||||
|
const char *property_name;
|
||||||
|
e_ply_type type, length_type, value_type;
|
||||||
|
ply_get_property_info(property, &property_name, &type,
|
||||||
|
&length_type, &value_type);
|
||||||
|
/* setup input callback for this property */
|
||||||
|
if (!ply_set_read_cb(iply, element_name, property_name, callback,
|
||||||
|
oply, 0)) return 0;
|
||||||
|
/* add this property to output file */
|
||||||
|
if (!ply_add_property(oply, property_name, type, length_type,
|
||||||
|
value_type)) return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
const char *value;
|
||||||
|
p_ply iply, oply;
|
||||||
|
iply = ply_open("input.ply", NULL);
|
||||||
|
if (!iply) return 1;
|
||||||
|
if (!ply_read_header(iply)) return 1;
|
||||||
|
oply = ply_create("output.ply", PLY_LITTLE_ENDIAN, NULL);
|
||||||
|
if (!oply) return 1;
|
||||||
|
if (!setup_callbacks(iply, oply)) return 1;
|
||||||
|
/* pass comments and obj_infos from input to output */
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_comment(iply, value)))
|
||||||
|
if (!ply_add_comment(oply, value)) return 1;
|
||||||
|
value = NULL;
|
||||||
|
while ((value = ply_get_next_obj_info(iply, value)))
|
||||||
|
if (!ply_add_obj_info(oply, value)) return 1;;
|
||||||
|
/* write output header */
|
||||||
|
if (!ply_write_header(oply)) return 1;
|
||||||
|
/* read input file generating callbacks that pass data to output file */
|
||||||
|
if (!ply_read(iply)) return 1;
|
||||||
|
/* close up, we are done */
|
||||||
|
if (!ply_close(iply)) return 1;
|
||||||
|
if (!ply_close(oply)) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p> RPly uses iterators to let the user loop over a PLY file header. A
|
||||||
|
function is used to get the first item of a given class (element, property
|
||||||
|
etc). Passing the last returned item to the same function produces the next
|
||||||
|
item, until there are no more items. Examples of iterator use can be seen
|
||||||
|
in the <tt>main</tt> function, which uses them to loop over comments and
|
||||||
|
obj_infos, and in the <tt>setup_callbacks</tt> function, which loops over
|
||||||
|
elements and properties. </p>
|
||||||
|
|
||||||
|
<p> In the <tt>setup_callbacks</tt> function, for each element in the
|
||||||
|
input, an equivalent element is defined in the output. For each property in
|
||||||
|
each element, an equivalent property is defined in the output. Notice that
|
||||||
|
the same callback is specified for all properties. It is given the output
|
||||||
|
PLY handle as the context pointer. Each time it is called, it passes the
|
||||||
|
received value to <tt>ply_write</tt> on the output handle. It is as simple
|
||||||
|
as that. </p>
|
||||||
|
|
||||||
|
<h1>Reference Manual</h1>
|
||||||
|
|
||||||
|
<!-- ply_open ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_open>
|
||||||
|
p_ply <b>ply_open</b>(const char *name, p_ply_error_cb error_cb)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Opens a PLY file for reading, checks if it is a valid PLY file
|
||||||
|
and returns a handle to it.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Name</tt> is the file name, and <tt>error_cb</tt> is a function to
|
||||||
|
be called when an error is found.
|
||||||
|
If <tt>error_cb</tt> is NULL, the default
|
||||||
|
error callback is used. It prints a message to the standard error stream.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns a handle to the file or NULL on error.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: <tt>Error_cb</tt> is of type <tt>void
|
||||||
|
(*p_ply_error_cb)(const char *message)</tt>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_read_header +++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_read_header>
|
||||||
|
int <b>ply_read_header</b>(p_ply ply)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Reads and parses the header of a PLY file.
|
||||||
|
After a call to this function, the query functions
|
||||||
|
<a href=#ply_get_next_element><tt>ply_get_next_element</tt></a>,
|
||||||
|
<a href=#ply_get_next_property><tt>ply_get_next_property</tt></a>,
|
||||||
|
<a href=#ply_get_next_comment><tt>ply_get_next_comment</tt></a>, and
|
||||||
|
<a href=#ply_get_next_obj_info><tt>ply_get_next_obj_info</tt></a> can be
|
||||||
|
called. Callbacks can also be set with the
|
||||||
|
<a href=#ply_set_read_cb><tt>ply_set_read_cb</tt></a> function.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_set_read_cb +++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_set_read_cb>
|
||||||
|
long <b>ply_set_read_cb</b>(<br>
|
||||||
|
p_ply ply,<br>
|
||||||
|
const char *element_name,<br>
|
||||||
|
const char *property_name,<br>
|
||||||
|
p_ply_read_cb read_cb,<br>
|
||||||
|
void *pdata,<br>
|
||||||
|
long idata<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Sets up the callback to be invoked when the value of a property is read.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
<tt>Element_name</tt> and <tt>property_name</tt> are the names of the
|
||||||
|
element and property of interest. <tt>Read_cb</tt> is the callback
|
||||||
|
function. <tt>Pdata</tt> and <tt>idata</tt> are user data to be passed to
|
||||||
|
the callback function.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the number of instances of the element of interest.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: <tt>Read_cb</tt> is of type
|
||||||
|
<tt>int (*p_ply_read_cb)(p_ply_argument argument)</tt>.
|
||||||
|
The callback should return 1 to continue the reading process,
|
||||||
|
or return 0 to abort.
|
||||||
|
|
||||||
|
<!-- ply_get_argument_element ++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_argument_element>
|
||||||
|
int <b>ply_get_argument_element</b>(<br>
|
||||||
|
p_ply_argument argument,<br>
|
||||||
|
p_ply_element *element,<br>
|
||||||
|
long *instance_index<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves element information from the callback argument.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Argument</tt> is the handle passed to the callback.
|
||||||
|
<tt>Element</tt> receives a handle to the element
|
||||||
|
originating the callback. <tt>Instance_index</tt> receives
|
||||||
|
the index of the instance of the element
|
||||||
|
being read. <tt>Element</tt> and <tt>instance_index</tt> can be NULL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: further information can be obtained from <tt>element</tt> with a
|
||||||
|
call to <a href=#ply_get_element_info>ply_get_element_info</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_argument_property +++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_argument_property>
|
||||||
|
int <b>ply_get_argument_property</b>(<br>
|
||||||
|
p_ply_argument argument,<br>
|
||||||
|
p_ply_property *property,<br>
|
||||||
|
long *length,<br>
|
||||||
|
long *value_index<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves property information from the callback argument.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Argument</tt> is the handle passed to the callback.
|
||||||
|
<tt>Property</tt> receives a handle to the property
|
||||||
|
originating the callback. <tt>Length</tt> receives the number
|
||||||
|
of values in the list property (1 for scalar properties).
|
||||||
|
<tt>Value_index</tt> receives the index of the current property entry (0 for
|
||||||
|
scalar properties, -1 for the first value of a list property, the one that
|
||||||
|
gives the number of entries). <tt>Property</tt>, <tt>length</tt> and
|
||||||
|
<tt>value_index</tt> can be NULL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: further information can be obtained from <tt>property</tt> with a
|
||||||
|
call to <a href=#ply_get_property_info>ply_get_property_info</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_argument_user_data +++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_argument_user_data>
|
||||||
|
int <b>ply_get_argument_user_data</b>(p_ply_argument argument, void *pdata,
|
||||||
|
long *idata)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves the user data from the callback argument.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Argument</tt> is the handle passed to the callback.
|
||||||
|
<tt>Pdata</tt> receives the user data pointer.
|
||||||
|
<tt>Idata</tt> receives the user data integer.
|
||||||
|
<tt>Pdata</tt> and <tt>idata</tt> can be NULL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_argument_value +++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_argument_value>
|
||||||
|
double <b>ply_get_argument_value</b>(p_ply_argument argument)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves the property value from the callback argument.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Argument</tt> is the handle passed to the callback.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the property value.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_read +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_read>
|
||||||
|
int <b>ply_read</b>(p_ply ply)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Reads all data in file, calling appropriate callbacks.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_next_element ++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_next_element>
|
||||||
|
p_ply_element <b>ply_get_next_element</b>(p_ply ply, p_ply_element last)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Iterates over all elements on the header of a PLY file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
<a href=#ply_read_header><tt>Ply_read_header</tt></a> must have been called
|
||||||
|
on the handle otherwise no elements will be found.
|
||||||
|
<tt>Last</tt> is NULL to retrieve the first element, and an element to
|
||||||
|
retrieve the next element.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the next element, or NULL if no more elements.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: further information can be obtained from an element with a
|
||||||
|
call to <a href=#ply_get_element_info>ply_get_element_info</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_next_property +++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_next_property>
|
||||||
|
p_ply_property <b>ply_get_next_property</b>(p_ply_element element, p_ply_property last)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Iterates over all properties of an element.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Element</tt> is an element handle.
|
||||||
|
<tt>Last</tt> is NULL to retrieve the first property, and a property to
|
||||||
|
retrieve the next property.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the next property, or NULL if no more properties.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: further information can be obtained from a property with a
|
||||||
|
call to <a href=#ply_get_property_info>ply_get_property_info</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_next_comment ++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_next_comment>
|
||||||
|
const char *<b>ply_get_next_comment</b>(p_ply ply, const char *last)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Iterates over all comments on the header of a PLY file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
<a href=#ply_read_header><tt>Ply_read_header</tt></a> must have been called
|
||||||
|
on the handle otherwise no comments will be found.
|
||||||
|
<tt>Last</tt> is NULL to retrieve the first comment, and a comment to
|
||||||
|
retrieve the next comment.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the next comment, or NULL if no more comments.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_next_obj_info +++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_next_obj_info>
|
||||||
|
const char *<b>ply_get_next_obj_info</b>(p_ply ply, const char *last)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Iterates over all obj_infos on the header of a PLY file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by <a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
<a href=#ply_read_header><tt>Ply_read_header</tt></a> must have been called
|
||||||
|
on the handle otherwise no obj_infos will be found.
|
||||||
|
<tt>Last</tt> is NULL to retrieve the first obj_info, and a obj_info to
|
||||||
|
retrieve the next obj_info.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns the next obj_info, or NULL if no more obj_infos.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_element_info ++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_element_info>
|
||||||
|
int <b>ply_get_element_info</b>(p_ply_element element, const char** name,
|
||||||
|
long *ninstances)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves information from an element handle.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Element</tt> is the handle of the element of interest.
|
||||||
|
<tt>Name</tt> receives the internal copy of the element name.
|
||||||
|
<tt>Ninstances</tt> receives the number of instances of this element
|
||||||
|
in the file. Both <tt>name</tt> and <tt>ninstances</tt> can be NULL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_get_property_info +++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_get_property_info>
|
||||||
|
int <b>ply_get_property_info</b>(<br>
|
||||||
|
p_ply_property property,<br>
|
||||||
|
const char** name,<br>
|
||||||
|
e_ply_type *type,<br>
|
||||||
|
e_ply_type *length_type,<br>
|
||||||
|
e_ply_type *value_type<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Retrieves information from a property handle.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Property</tt> is the handle of the property of interest.
|
||||||
|
<tt>Name</tt> receives the internal copy of the property name.
|
||||||
|
<tt>Type</tt> receives the property type.
|
||||||
|
<tt>Length_type</tt> receives the scalar type of the first entry
|
||||||
|
in a list property (the one that gives the number of entries).
|
||||||
|
<tt>Value_type</tt> receives the scalar type of the remaining list entries.
|
||||||
|
<tt>Name</tt>, <tt>type</tt>, <tt>length_type</tt>, and
|
||||||
|
<tt>value_type</tt> can be NULL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: <tt>Length_type</tt> and <tt>value_type</tt> can
|
||||||
|
receive any of the constants for scalar types defined in
|
||||||
|
<tt>e_ply_type</tt>. <tt>Type</tt> can, in addition, be <tt>PLY_LIST</tt>,
|
||||||
|
in which case the property is a list property and the fields
|
||||||
|
<tt>length_type</tt> and <tt>value_type</tt> become meaningful.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_create ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_create>
|
||||||
|
p_ply <b>ply_create</b>(const char *name, e_ply_storage_mode storage_mode,
|
||||||
|
p_ply_error_cb error_cb)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Creates a PLY file for writing.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Name</tt> is the file name, <tt>storage_mode</tt> is the file storage mode
|
||||||
|
(<tt>PLY_ASCII</tt>, <tt>PLY_LITTLE_ENDIAN</tt> or <tt>PLY_BIG_ENDIAN</tt>). <tt>Error_cb</tt> is a function to be called when an error is found.
|
||||||
|
If <tt>error_cb</tt> is NULL, the default
|
||||||
|
error callback is used. It prints a message to the standard error stream.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns a handle to the file or NULL on error.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: <tt>Error_cb</tt> is of type <tt>void
|
||||||
|
(*p_ply_error_cb)(const char *message)</tt>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_element +++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_element>
|
||||||
|
int <b>ply_add_element</b>(p_ply ply, const char *name, long ninstances)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Adds a new element to the ply file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a>, <tt>name</tt> is the element
|
||||||
|
name and <tt>ninstances</tt> is the number of instances of this element that
|
||||||
|
will be written to the file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_property ++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_property>
|
||||||
|
int <b>ply_add_property</b>(<br>
|
||||||
|
p_ply ply,<br>
|
||||||
|
const char *name,<br>
|
||||||
|
e_ply_type type,<br>
|
||||||
|
e_ply_type length_type,<br>
|
||||||
|
e_ply_type value_type<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Adds a new property to the last element added to the ply file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> and <tt>name</tt> is the
|
||||||
|
property name.
|
||||||
|
<tt>Type</tt> is the property type.
|
||||||
|
<tt>Length_type</tt> is the scalar type of the first entry
|
||||||
|
in a list property (the one that gives the number of entries).
|
||||||
|
<tt>Value_type</tt> is the scalar type of the remaining list entries.
|
||||||
|
If <tt>type</tt> is not <tt>PLY_LIST</tt>, <tt>length_type</tt> and
|
||||||
|
<tt>value_type</tt> are ignored.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=note>
|
||||||
|
Note: <tt>Length_type</tt> and <tt>value_type</tt> can
|
||||||
|
be any of the constants for scalar types defined in
|
||||||
|
<tt>e_ply_type</tt>. <tt>Type</tt> can, in addition, be <tt>PLY_LIST</tt>,
|
||||||
|
in which case the property is a list property and the fields
|
||||||
|
<tt>length_type</tt> and <tt>value_type</tt> become meaningful.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_list_property ++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_list_property>
|
||||||
|
int <b>ply_add_list_property</b>(<br>
|
||||||
|
p_ply ply,<br>
|
||||||
|
const char *name,<br>
|
||||||
|
e_ply_type length_type,<br>
|
||||||
|
e_ply_type value_type<br>
|
||||||
|
)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Same as <a href=#ply_add_property><tt>ply_add_property</tt></a> if
|
||||||
|
<tt>type</tt> is <tt>PLY_LIST</tt>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_scalar_property +++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_scalar_property>
|
||||||
|
int <b>ply_add_scalar_property</b>(p_ply ply, const char *name, e_ply_type type)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Same as <a href=#ply_add_property><tt>ply_add_property</tt></a> if
|
||||||
|
<tt>type</tt> is <em>not</em> <tt>PLY_LIST</tt>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_comment +++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_comment>
|
||||||
|
int <b>ply_add_comment</b>(p_ply ply, const char *comment);
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Adds a comment to a PLY file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> and <tt>comment</tt> is the
|
||||||
|
comment text.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_add_obj_info ++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_add_obj_info>
|
||||||
|
int <b>ply_add_obj_info</b>(p_ply ply, const char *obj_info);
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Adds a obj_info to a PLY file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> and <tt>obj_info</tt> is the
|
||||||
|
obj_info text.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_write_header ++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_write_header>
|
||||||
|
int <b>ply_write_header</b>(p_ply ply);
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Writes the PLY file header to disk, after all elements, properties,
|
||||||
|
comments and obj_infos have been added to the handle.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> and <tt>comment</tt> is the
|
||||||
|
comment text.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_write +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_write>
|
||||||
|
int <b>ply_write</b>(p_ply ply, double value);
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Passes a value to be stored in the PLY file.
|
||||||
|
Values must be passed in the order they will appear in the file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> and <tt>value</tt> is the
|
||||||
|
value to be stored. For simplicity, values are always passed as
|
||||||
|
<tt>double</tt> and conversion is performed as needed.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ply_close +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<p class=name id=ply_close>
|
||||||
|
int <b>ply_close</b>(p_ply ply);
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=description>
|
||||||
|
Closes the handle and ensures that all resources have been freed and data
|
||||||
|
have been written.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=arguments>
|
||||||
|
<tt>Ply</tt> is a handle returned by
|
||||||
|
<a href=#ply_create><tt>ply_create</tt></a> or by
|
||||||
|
<a href=#ply_open><tt>ply_open</tt></a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class=return>
|
||||||
|
Returns 1 in case of success, 0 otherwise.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- footer ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||||
|
|
||||||
|
<div class=footer>
|
||||||
|
<hr>
|
||||||
|
<center>
|
||||||
|
<p>
|
||||||
|
<small>
|
||||||
|
Last modified by Diego Nehab on <br>
|
||||||
|
Fri Jul 16 15:23:01 EDT 2004
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
body {
|
||||||
|
margin-left: 1em;
|
||||||
|
margin-right: 1em;
|
||||||
|
font-family: "Verdana", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt {
|
||||||
|
font-family: "Andale Mono", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4 { margin-left: 0em; }
|
||||||
|
|
||||||
|
|
||||||
|
h3 { padding-top: 1em; }
|
||||||
|
|
||||||
|
p { margin-left: 1em; }
|
||||||
|
|
||||||
|
p.name {
|
||||||
|
font-family: "Andale Mono", monospace;
|
||||||
|
padding-top: 1em;
|
||||||
|
margin-left: 0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a[href] { color: #7f0000; }
|
||||||
|
|
||||||
|
blockquote { margin-left: 3em; }
|
||||||
|
|
||||||
|
pre.example {
|
||||||
|
background: #cbb;
|
||||||
|
padding: 1em;
|
||||||
|
margin-left: 1em;
|
||||||
|
font-family: "Andale Mono", monospace;
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin-left: 0em;
|
||||||
|
background: #7f0000;
|
||||||
|
border: 0px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul { list-style-type: disc; }
|
||||||
|
|
||||||
|
table.index { border: 1px #7f0000; }
|
||||||
|
table.index td { text-align: left; vertical-align: top; }
|
||||||
|
table.index ul { padding-top: 0em; margin-top: 0em; }
|
||||||
|
|
||||||
|
h1:first-letter,
|
||||||
|
h2:first-letter,
|
||||||
|
h2:first-letter,
|
||||||
|
h3:first-letter { color: #7f0000; }
|
||||||
|
|
||||||
|
div.header, div.footer { margin-left: 0em; }
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rply", "Rply.vcproj", "{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
Name="Rply"
|
||||||
|
ProjectGUID="{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}"
|
||||||
|
RootNamespace="Rply"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)..\..\lib\vc2008\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
ProgramDataBaseFileName="$(OutDir)\vc90.pdb"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)..\..\lib\vc2008\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
ProgramDataBaseFileName="$(OutDir)\vc90.pdb"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\rply.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\rply.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioUserFile
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
ShowAllFiles="false"
|
||||||
|
>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<DebugSettings
|
||||||
|
Command=""
|
||||||
|
WorkingDirectory=""
|
||||||
|
CommandArguments=""
|
||||||
|
Attach="false"
|
||||||
|
DebuggerType="3"
|
||||||
|
Remote="1"
|
||||||
|
RemoteMachine="REYNOLDS"
|
||||||
|
RemoteCommand=""
|
||||||
|
HttpUrl=""
|
||||||
|
PDBPath=""
|
||||||
|
SQLDebugging=""
|
||||||
|
Environment=""
|
||||||
|
EnvironmentMerge="true"
|
||||||
|
DebuggerFlavor=""
|
||||||
|
MPIRunCommand=""
|
||||||
|
MPIRunArguments=""
|
||||||
|
MPIRunWorkingDirectory=""
|
||||||
|
ApplicationCommand=""
|
||||||
|
ApplicationArguments=""
|
||||||
|
ShimCommand=""
|
||||||
|
MPIAcceptMode=""
|
||||||
|
MPIAcceptFilter=""
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<DebugSettings
|
||||||
|
Command=""
|
||||||
|
WorkingDirectory=""
|
||||||
|
CommandArguments=""
|
||||||
|
Attach="false"
|
||||||
|
DebuggerType="3"
|
||||||
|
Remote="1"
|
||||||
|
RemoteMachine="REYNOLDS"
|
||||||
|
RemoteCommand=""
|
||||||
|
HttpUrl=""
|
||||||
|
PDBPath=""
|
||||||
|
SQLDebugging=""
|
||||||
|
Environment=""
|
||||||
|
EnvironmentMerge="true"
|
||||||
|
DebuggerFlavor=""
|
||||||
|
MPIRunCommand=""
|
||||||
|
MPIRunArguments=""
|
||||||
|
MPIRunWorkingDirectory=""
|
||||||
|
ApplicationCommand=""
|
||||||
|
ApplicationArguments=""
|
||||||
|
ShimCommand=""
|
||||||
|
MPIAcceptMode=""
|
||||||
|
MPIAcceptFilter=""
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
</VisualStudioUserFile>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rply", "Rply.vcproj", "{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
Name="Rply"
|
||||||
|
ProjectGUID="{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}"
|
||||||
|
RootNamespace="Rply"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)..\lib\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
ProgramDataBaseFileName="$(OutDir)\vc90.pdb"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)..\lib\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
ProgramDataBaseFileName="$(OutDir)\vc90.pdb"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rply.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rply.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\rply.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\rply.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{A1A9B043-929D-4D3A-96F3-9BEF0AA06C7E}</ProjectGuid>
|
||||||
|
<RootNamespace>Rply</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\lib\vc2010\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\lib\vc2010\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<ProgramDataBaseFileName>$(OutDir)vc100.pdb</ProgramDataBaseFileName>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<ProgramDataBaseFileName>$(OutDir)vc100.pdb</ProgramDataBaseFileName>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\rply.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\rply.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
+1497
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,365 @@
|
|||||||
|
#ifndef PLY_H
|
||||||
|
#define PLY_H
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* RPly library, read/write PLY files
|
||||||
|
* Diego Nehab, Princeton University
|
||||||
|
* http://www.cs.princeton.edu/~diego/professional/rply
|
||||||
|
*
|
||||||
|
* This library is distributed under the MIT License. See notice
|
||||||
|
* at the end of this file.
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define RPLY_VERSION "RPly 1.01"
|
||||||
|
#define RPLY_COPYRIGHT "Copyright (C) 2003-2005 Diego Nehab"
|
||||||
|
#define RPLY_AUTHORS "Diego Nehab"
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Types
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
/* structures are opaque */
|
||||||
|
typedef struct t_ply_ *p_ply;
|
||||||
|
typedef struct t_ply_element_ *p_ply_element;
|
||||||
|
typedef struct t_ply_property_ *p_ply_property;
|
||||||
|
typedef struct t_ply_argument_ *p_ply_argument;
|
||||||
|
|
||||||
|
/* ply format mode type */
|
||||||
|
typedef enum e_ply_storage_mode_ {
|
||||||
|
PLY_BIG_ENDIAN,
|
||||||
|
PLY_LITTLE_ENDIAN,
|
||||||
|
PLY_ASCII,
|
||||||
|
PLY_DEFAULT /* has to be the last in enum */
|
||||||
|
} e_ply_storage_mode; /* order matches ply_storage_mode_list */
|
||||||
|
|
||||||
|
/* ply data type */
|
||||||
|
typedef enum e_ply_type {
|
||||||
|
PLY_INT8, PLY_UINT8, PLY_INT16, PLY_UINT16,
|
||||||
|
PLY_INT32, PLY_UIN32, PLY_FLOAT32, PLY_FLOAT64,
|
||||||
|
PLY_CHAR, PLY_UCHAR, PLY_SHORT, PLY_USHORT,
|
||||||
|
PLY_INT, PLY_UINT, PLY_FLOAT, PLY_DOUBLE,
|
||||||
|
PLY_LIST /* has to be the last in enum */
|
||||||
|
} e_ply_type; /* order matches ply_type_list */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Property reading callback prototype
|
||||||
|
*
|
||||||
|
* message: error message
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
typedef void (*p_ply_error_cb)(const char *message);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Opens a ply file for reading (fails if file is not a ply file)
|
||||||
|
*
|
||||||
|
* error_cb: error callback function
|
||||||
|
* name: file name
|
||||||
|
*
|
||||||
|
* Returns 1 if successful, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
p_ply ply_open(const char *name, p_ply_error_cb error_cb);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Reads and parses the header of a ply file returned by ply_open
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_read_header(p_ply ply);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Property reading callback prototype
|
||||||
|
*
|
||||||
|
* argument: parameters for property being processed when callback is called
|
||||||
|
*
|
||||||
|
* Returns 1 if should continue processing file, 0 if should abort.
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
typedef int (*p_ply_read_cb)(p_ply_argument argument);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Sets up callbacks for property reading after header was parsed
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
* element_name: element where property is
|
||||||
|
* property_name: property to associate element with
|
||||||
|
* read_cb: function to be called for each property value
|
||||||
|
* pdata/idata: user data that will be passed to callback
|
||||||
|
*
|
||||||
|
* Returns 0 if no element or no property in element, returns the
|
||||||
|
* number of element instances otherwise.
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
long ply_set_read_cb(p_ply ply, const char *element_name,
|
||||||
|
const char *property_name, p_ply_read_cb read_cb,
|
||||||
|
void *pdata, long idata);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns information about the element originating a callback
|
||||||
|
*
|
||||||
|
* argument: handle to argument
|
||||||
|
* element: receives a the element handle (if non-null)
|
||||||
|
* instance_index: receives the index of the current element instance
|
||||||
|
* (if non-null)
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_get_argument_element(p_ply_argument argument,
|
||||||
|
p_ply_element *element, long *instance_index);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns information about the property originating a callback
|
||||||
|
*
|
||||||
|
* argument: handle to argument
|
||||||
|
* property: receives the property handle (if non-null)
|
||||||
|
* length: receives the number of values in this property (if non-null)
|
||||||
|
* value_index: receives the index of current property value (if non-null)
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_get_argument_property(p_ply_argument argument,
|
||||||
|
p_ply_property *property, long *length, long *value_index);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns user data associated with callback
|
||||||
|
*
|
||||||
|
* pdata: receives a copy of user custom data pointer (if non-null)
|
||||||
|
* idata: receives a copy of user custom data integer (if non-null)
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_get_argument_user_data(p_ply_argument argument, void **pdata,
|
||||||
|
long *idata);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns the value associated with a callback
|
||||||
|
*
|
||||||
|
* argument: handle to argument
|
||||||
|
*
|
||||||
|
* Returns the current data item
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
double ply_get_argument_value(p_ply_argument argument);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Reads all elements and properties calling the callbacks defined with
|
||||||
|
* calls to ply_set_read_cb
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_read(p_ply ply);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Iterates over all elements by returning the next element.
|
||||||
|
* Call with NULL to return handle to first element.
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
* last: handle of last element returned (NULL for first element)
|
||||||
|
*
|
||||||
|
* Returns element if successfull or NULL if no more elements
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
p_ply_element ply_get_next_element(p_ply ply, p_ply_element last);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Iterates over all comments by returning the next comment.
|
||||||
|
* Call with NULL to return pointer to first comment.
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
* last: pointer to last comment returned (NULL for first comment)
|
||||||
|
*
|
||||||
|
* Returns comment if successfull or NULL if no more comments
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
const char *ply_get_next_comment(p_ply ply, const char *last);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Iterates over all obj_infos by returning the next obj_info.
|
||||||
|
* Call with NULL to return pointer to first obj_info.
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_open
|
||||||
|
* last: pointer to last obj_info returned (NULL for first obj_info)
|
||||||
|
*
|
||||||
|
* Returns obj_info if successfull or NULL if no more obj_infos
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
const char *ply_get_next_obj_info(p_ply ply, const char *last);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns information about an element
|
||||||
|
*
|
||||||
|
* element: element of interest
|
||||||
|
* name: receives a pointer to internal copy of element name (if non-null)
|
||||||
|
* ninstances: receives the number of instances of this element (if non-null)
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull or 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_get_element_info(p_ply_element element, const char** name,
|
||||||
|
long *ninstances);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Iterates over all properties by returning the next property.
|
||||||
|
* Call with NULL to return handle to first property.
|
||||||
|
*
|
||||||
|
* element: handle of element with the properties of interest
|
||||||
|
* last: handle of last property returned (NULL for first property)
|
||||||
|
*
|
||||||
|
* Returns element if successfull or NULL if no more properties
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
p_ply_property ply_get_next_property(p_ply_element element,
|
||||||
|
p_ply_property last);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Returns information about a property
|
||||||
|
*
|
||||||
|
* property: handle to property of interest
|
||||||
|
* name: receives a pointer to internal copy of property name (if non-null)
|
||||||
|
* type: receives the property type (if non-null)
|
||||||
|
* length_type: for list properties, receives the scalar type of
|
||||||
|
* the length field (if non-null)
|
||||||
|
* value_type: for list properties, receives the scalar type of the value
|
||||||
|
* fields (if non-null)
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull or 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_get_property_info(p_ply_property property, const char** name,
|
||||||
|
e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Creates new ply file
|
||||||
|
*
|
||||||
|
* name: file name
|
||||||
|
* storage_mode: file format mode
|
||||||
|
*
|
||||||
|
* Returns handle to ply file if successfull, NULL otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
p_ply ply_create(const char *name, e_ply_storage_mode storage_mode,
|
||||||
|
p_ply_error_cb error_cb);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new element to the ply file created by ply_create
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* name: name of new element
|
||||||
|
* ninstances: number of element of this time in file
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_element(p_ply ply, const char *name, long ninstances);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new property to the last element added by ply_add_element
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* name: name of new property
|
||||||
|
* type: property type
|
||||||
|
* length_type: scalar type of length field of a list property
|
||||||
|
* value_type: scalar type of value fields of a list property
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_property(p_ply ply, const char *name, e_ply_type type,
|
||||||
|
e_ply_type length_type, e_ply_type value_type);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new list property to the last element added by ply_add_element
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* name: name of new property
|
||||||
|
* length_type: scalar type of length field of a list property
|
||||||
|
* value_type: scalar type of value fields of a list property
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_list_property(p_ply ply, const char *name,
|
||||||
|
e_ply_type length_type, e_ply_type value_type);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new property to the last element added by ply_add_element
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* name: name of new property
|
||||||
|
* type: property type
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new comment item
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* comment: pointer to string with comment text
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_comment(p_ply ply, const char *comment);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Adds a new obj_info item
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
* comment: pointer to string with obj_info data
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_add_obj_info(p_ply ply, const char *obj_info);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Writes the ply file header after all element and properties have been
|
||||||
|
* defined by calls to ply_add_element and ply_add_property
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_write_header(p_ply ply);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Writes one property value, in the order they should be written to the
|
||||||
|
* file. For each element type, write all elements of that type in order.
|
||||||
|
* For each element, write all its properties in order. For scalar
|
||||||
|
* properties, just write the value. For list properties, write the length
|
||||||
|
* and then each of the values.
|
||||||
|
*
|
||||||
|
* ply: handle returned by ply_create
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_write(p_ply ply, double value);
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Closes a ply file handle. Releases all memory used by handle
|
||||||
|
*
|
||||||
|
* ply: handle to be closed.
|
||||||
|
*
|
||||||
|
* Returns 1 if successfull, 0 otherwise
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
|
int ply_close(p_ply ply);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* RPLY_H */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Copyright (C) 2003-2005 Diego Nehab. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
* ---------------------------------------------------------------------- */
|
||||||
+726
@@ -0,0 +1,726 @@
|
|||||||
|
# Blender3D v249 OBJ File:
|
||||||
|
# www.blender3d.org
|
||||||
|
v 3.604832 -19.615911 -1.493169
|
||||||
|
v 7.071138 -18.477781 -2.928961
|
||||||
|
v 10.265704 -16.629568 -4.252193
|
||||||
|
v 13.065765 -14.142282 -5.412017
|
||||||
|
v 15.363715 -11.111519 -6.363859
|
||||||
|
v 17.071245 -7.653746 -7.071141
|
||||||
|
v 18.122736 -3.901844 -7.506683
|
||||||
|
v 18.477781 0.000002 -7.653748
|
||||||
|
v 18.122736 3.901848 -7.506683
|
||||||
|
v 17.071245 7.653747 -7.071142
|
||||||
|
v 15.363715 11.111520 -6.363860
|
||||||
|
v 13.065765 14.142282 -5.412018
|
||||||
|
v 10.265705 16.629564 -4.252195
|
||||||
|
v 7.071141 18.477783 -2.928963
|
||||||
|
v 3.604837 19.615910 -1.493173
|
||||||
|
v 2.759022 19.615910 -2.759023
|
||||||
|
v 5.412017 18.477783 -5.412018
|
||||||
|
v 7.857030 16.629564 -7.857031
|
||||||
|
v 10.000104 14.142282 -10.000105
|
||||||
|
v 11.758878 11.111519 -11.758879
|
||||||
|
v 13.065765 7.653747 -13.065765
|
||||||
|
v 13.870541 3.901847 -13.870542
|
||||||
|
v 14.142281 0.000001 -14.142282
|
||||||
|
v 13.870541 -3.901845 -13.870542
|
||||||
|
v 13.065765 -7.653746 -13.065765
|
||||||
|
v 11.758878 -11.111520 -11.758877
|
||||||
|
v 10.000104 -14.142282 -10.000103
|
||||||
|
v 7.857029 -16.629568 -7.857028
|
||||||
|
v 5.412015 -18.477781 -5.412014
|
||||||
|
v 2.759019 -19.615911 -2.759018
|
||||||
|
v -0.000005 -20.000208 0.000005
|
||||||
|
v 1.493170 -19.615911 -3.604831
|
||||||
|
v 2.928961 -18.477781 -7.071137
|
||||||
|
v 4.252193 -16.629568 -10.265702
|
||||||
|
v 5.412017 -14.142283 -13.065764
|
||||||
|
v 6.363859 -11.111520 -15.363713
|
||||||
|
v 7.071141 -7.653747 -17.071245
|
||||||
|
v 7.506682 -3.901845 -18.122736
|
||||||
|
v 7.653747 0.000001 -18.477781
|
||||||
|
v 7.506682 3.901847 -18.122736
|
||||||
|
v 7.071141 7.653747 -17.071245
|
||||||
|
v 6.363859 11.111519 -15.363715
|
||||||
|
v 5.412017 14.142282 -13.065766
|
||||||
|
v 4.252194 16.629564 -10.265706
|
||||||
|
v 2.928962 18.477783 -7.071142
|
||||||
|
v 1.493172 19.615910 -3.604837
|
||||||
|
v -0.000000 19.615910 -3.901848
|
||||||
|
v -0.000000 18.477783 -7.653749
|
||||||
|
v -0.000000 16.629564 -11.111520
|
||||||
|
v -0.000000 14.142282 -14.142282
|
||||||
|
v -0.000000 11.111519 -16.629564
|
||||||
|
v -0.000001 7.653747 -18.477781
|
||||||
|
v -0.000001 3.901847 -19.615908
|
||||||
|
v -0.000001 0.000001 -20.000206
|
||||||
|
v -0.000001 -3.901845 -19.615908
|
||||||
|
v -0.000001 -7.653747 -18.477781
|
||||||
|
v -0.000000 -11.111520 -16.629564
|
||||||
|
v -0.000000 -14.142283 -14.142281
|
||||||
|
v -0.000000 -16.629568 -11.111516
|
||||||
|
v 0.000000 -18.477781 -7.653743
|
||||||
|
v -0.000000 -19.615911 -3.901841
|
||||||
|
v -1.493170 -19.615911 -3.604831
|
||||||
|
v -2.928961 -18.477781 -7.071136
|
||||||
|
v -4.252193 -16.629568 -10.265702
|
||||||
|
v -5.412017 -14.142283 -13.065763
|
||||||
|
v -6.363859 -11.111520 -15.363712
|
||||||
|
v -7.071141 -7.653747 -17.071243
|
||||||
|
v -7.506684 -3.901845 -18.122734
|
||||||
|
v -7.653749 0.000001 -18.477779
|
||||||
|
v -7.506684 3.901847 -18.122734
|
||||||
|
v -7.071141 7.653747 -17.071243
|
||||||
|
v -6.363859 11.111519 -15.363714
|
||||||
|
v -5.412017 14.142282 -13.065764
|
||||||
|
v -4.252194 16.629564 -10.265705
|
||||||
|
v -2.928963 18.477783 -7.071141
|
||||||
|
v -1.493172 19.615910 -3.604837
|
||||||
|
v 0.000000 20.000208 -0.000001
|
||||||
|
v -2.759022 19.615910 -2.759023
|
||||||
|
v -5.412017 18.477783 -5.412017
|
||||||
|
v -7.857030 16.629564 -7.857030
|
||||||
|
v -10.000103 14.142282 -10.000103
|
||||||
|
v -11.758877 11.111519 -11.758878
|
||||||
|
v -13.065764 7.653747 -13.065763
|
||||||
|
v -13.870542 3.901847 -13.870539
|
||||||
|
v -14.142282 0.000001 -14.142279
|
||||||
|
v -13.870542 -3.901845 -13.870539
|
||||||
|
v -13.065764 -7.653746 -13.065763
|
||||||
|
v -11.758877 -11.111520 -11.758876
|
||||||
|
v -10.000103 -14.142282 -10.000101
|
||||||
|
v -7.857029 -16.629568 -7.857028
|
||||||
|
v -5.412014 -18.477781 -5.412013
|
||||||
|
v -2.759019 -19.615911 -2.759018
|
||||||
|
v -3.604831 -19.615911 -1.493169
|
||||||
|
v -7.071137 -18.477781 -2.928960
|
||||||
|
v -10.265703 -16.629568 -4.252192
|
||||||
|
v -13.065763 -14.142282 -5.412015
|
||||||
|
v -15.363712 -11.111519 -6.363858
|
||||||
|
v -17.071243 -7.653746 -7.071139
|
||||||
|
v -18.122734 -3.901844 -7.506680
|
||||||
|
v -18.477779 0.000002 -7.653745
|
||||||
|
v -18.122734 3.901848 -7.506680
|
||||||
|
v -17.071243 7.653747 -7.071140
|
||||||
|
v -15.363712 11.111520 -6.363859
|
||||||
|
v -13.065763 14.142282 -5.412016
|
||||||
|
v -10.265704 16.629564 -4.252194
|
||||||
|
v -7.071140 18.477783 -2.928962
|
||||||
|
v -3.604836 19.615910 -1.493173
|
||||||
|
v -3.901846 19.615910 -0.000001
|
||||||
|
v -7.653747 18.477783 -0.000000
|
||||||
|
v -11.111518 16.629564 -0.000000
|
||||||
|
v -14.142280 14.142282 0.000000
|
||||||
|
v -16.629562 11.111520 -0.000001
|
||||||
|
v -18.477779 7.653748 0.000000
|
||||||
|
v -19.615904 3.901848 0.000002
|
||||||
|
v -20.000202 0.000002 0.000002
|
||||||
|
v -19.615904 -3.901844 0.000002
|
||||||
|
v -18.477779 -7.653746 0.000001
|
||||||
|
v -16.629562 -11.111519 0.000000
|
||||||
|
v -14.142280 -14.142282 0.000002
|
||||||
|
v -11.111517 -16.629568 0.000001
|
||||||
|
v -7.653743 -18.477781 0.000001
|
||||||
|
v -3.901841 -19.615911 0.000001
|
||||||
|
v -3.604831 -19.615911 1.493171
|
||||||
|
v -7.071136 -18.477781 2.928962
|
||||||
|
v -10.265703 -16.629568 4.252194
|
||||||
|
v -13.065762 -14.142282 5.412017
|
||||||
|
v -15.363712 -11.111519 6.363858
|
||||||
|
v -17.071241 -7.653745 7.071141
|
||||||
|
v -18.122730 -3.901844 7.506683
|
||||||
|
v -18.477776 0.000002 7.653748
|
||||||
|
v -18.122730 3.901848 7.506683
|
||||||
|
v -17.071241 7.653748 7.071140
|
||||||
|
v -15.363712 11.111520 6.363857
|
||||||
|
v -13.065762 14.142282 5.412016
|
||||||
|
v -10.265703 16.629564 4.252193
|
||||||
|
v -7.071139 18.477783 2.928962
|
||||||
|
v -3.604836 19.615910 1.493171
|
||||||
|
v -2.759022 19.615910 2.759021
|
||||||
|
v -5.412015 18.477783 5.412015
|
||||||
|
v -7.857028 16.629564 7.857029
|
||||||
|
v -10.000100 14.142282 10.000101
|
||||||
|
v -11.758876 11.111521 11.758875
|
||||||
|
v -13.065762 7.653748 13.065763
|
||||||
|
v -13.870536 3.901849 13.870540
|
||||||
|
v -14.142276 0.000003 14.142280
|
||||||
|
v -13.870536 -3.901843 13.870540
|
||||||
|
v -13.065762 -7.653745 13.065763
|
||||||
|
v -11.758876 -11.111518 11.758877
|
||||||
|
v -10.000100 -14.142282 10.000103
|
||||||
|
v -7.857029 -16.629568 7.857030
|
||||||
|
v -5.412014 -18.477781 5.412014
|
||||||
|
v -2.759018 -19.615911 2.759019
|
||||||
|
v -1.493170 -19.615911 3.604832
|
||||||
|
v -2.928961 -18.477781 7.071137
|
||||||
|
v -4.252193 -16.629568 10.265704
|
||||||
|
v -5.412014 -14.142282 13.065763
|
||||||
|
v -6.363857 -11.111518 15.363712
|
||||||
|
v -7.071138 -7.653745 17.071241
|
||||||
|
v -7.506678 -3.901843 18.122732
|
||||||
|
v -7.653743 0.000003 18.477777
|
||||||
|
v -7.506678 3.901849 18.122732
|
||||||
|
v -7.071138 7.653749 17.071241
|
||||||
|
v -6.363857 11.111521 15.363710
|
||||||
|
v -5.412014 14.142283 13.065761
|
||||||
|
v -4.252192 16.629564 10.265702
|
||||||
|
v -2.928961 18.477783 7.071139
|
||||||
|
v -1.493172 19.615910 3.604835
|
||||||
|
v 0.000000 19.615910 3.901845
|
||||||
|
v 0.000001 18.477783 7.653745
|
||||||
|
v 0.000001 16.629564 11.111515
|
||||||
|
v 0.000002 14.142283 14.142277
|
||||||
|
v 0.000000 11.111521 16.629560
|
||||||
|
v 0.000001 7.653749 18.477777
|
||||||
|
v 0.000003 3.901849 19.615902
|
||||||
|
v 0.000003 0.000003 20.000200
|
||||||
|
v 0.000003 -3.901843 19.615902
|
||||||
|
v 0.000001 -7.653745 18.477777
|
||||||
|
v 0.000000 -11.111518 16.629560
|
||||||
|
v 0.000002 -14.142282 14.142279
|
||||||
|
v 0.000000 -16.629568 11.111518
|
||||||
|
v 0.000000 -18.477781 7.653744
|
||||||
|
v 0.000000 -19.615911 3.901842
|
||||||
|
v 1.493170 -19.615911 3.604832
|
||||||
|
v 2.928961 -18.477781 7.071137
|
||||||
|
v 4.252193 -16.629568 10.265704
|
||||||
|
v 5.412017 -14.142282 13.065761
|
||||||
|
v 6.363858 -11.111518 15.363711
|
||||||
|
v 7.071140 -7.653745 17.071239
|
||||||
|
v 7.506683 -3.901843 18.122728
|
||||||
|
v 7.653748 0.000003 18.477774
|
||||||
|
v 7.506683 3.901849 18.122728
|
||||||
|
v 7.071140 7.653749 17.071239
|
||||||
|
v 6.363858 11.111521 15.363709
|
||||||
|
v 5.412017 14.142283 13.065759
|
||||||
|
v 4.252194 16.629564 10.265700
|
||||||
|
v 2.928962 18.477783 7.071138
|
||||||
|
v 1.493172 19.615910 3.604835
|
||||||
|
v 2.759022 19.615910 2.759021
|
||||||
|
v 5.412016 18.477783 5.412014
|
||||||
|
v 7.857028 16.629564 7.857026
|
||||||
|
v 10.000101 14.142282 10.000097
|
||||||
|
v 11.758875 11.111521 11.758873
|
||||||
|
v 13.065762 7.653748 13.065760
|
||||||
|
v 13.870539 3.901849 13.870534
|
||||||
|
v 14.142279 0.000003 14.142274
|
||||||
|
v 13.870539 -3.901843 13.870534
|
||||||
|
v 13.065762 -7.653745 13.065760
|
||||||
|
v 11.758875 -11.111518 11.758875
|
||||||
|
v 10.000101 -14.142282 10.000099
|
||||||
|
v 7.857029 -16.629568 7.857030
|
||||||
|
v 5.412013 -18.477781 5.412014
|
||||||
|
v 2.759018 -19.615911 2.759019
|
||||||
|
v 3.604831 -19.615911 1.493170
|
||||||
|
v 7.071136 -18.477781 2.928961
|
||||||
|
v 10.265703 -16.629568 4.252194
|
||||||
|
v 13.065761 -14.142282 5.412014
|
||||||
|
v 15.363709 -11.111519 6.363857
|
||||||
|
v 17.071239 -7.653745 7.071137
|
||||||
|
v 18.122730 -3.901844 7.506677
|
||||||
|
v 18.477776 0.000002 7.653741
|
||||||
|
v 18.122730 3.901848 7.506677
|
||||||
|
v 17.071239 7.653748 7.071136
|
||||||
|
v 15.363709 11.111520 6.363856
|
||||||
|
v 13.065761 14.142282 5.412013
|
||||||
|
v 10.265701 16.629564 4.252191
|
||||||
|
v 7.071139 18.477783 2.928960
|
||||||
|
v 3.604836 19.615910 1.493171
|
||||||
|
v 3.901846 19.615910 -0.000001
|
||||||
|
v 7.653745 18.477783 -0.000002
|
||||||
|
v 11.111514 16.629564 -0.000002
|
||||||
|
v 14.142276 14.142282 -0.000003
|
||||||
|
v 16.629559 11.111520 -0.000001
|
||||||
|
v 18.477776 7.653748 -0.000002
|
||||||
|
v 19.615900 3.901848 -0.000004
|
||||||
|
v 20.000198 0.000002 -0.000004
|
||||||
|
v 19.615900 -3.901844 -0.000004
|
||||||
|
v 18.477776 -7.653746 -0.000002
|
||||||
|
v 16.629559 -11.111519 -0.000000
|
||||||
|
v 14.142276 -14.142282 -0.000001
|
||||||
|
v 11.111517 -16.629568 0.000001
|
||||||
|
v 7.653742 -18.477781 0.000001
|
||||||
|
v 3.901840 -19.615911 0.000001
|
||||||
|
usemtl (null)
|
||||||
|
s off
|
||||||
|
f 31 1 242
|
||||||
|
f 228 15 77
|
||||||
|
f 15 16 77
|
||||||
|
f 30 1 31
|
||||||
|
f 31 32 30
|
||||||
|
f 16 46 77
|
||||||
|
f 46 47 77
|
||||||
|
f 31 61 32
|
||||||
|
f 31 62 61
|
||||||
|
f 47 76 77
|
||||||
|
f 76 78 77
|
||||||
|
f 31 92 62
|
||||||
|
f 31 93 92
|
||||||
|
f 78 107 77
|
||||||
|
f 107 108 77
|
||||||
|
f 31 122 93
|
||||||
|
f 31 123 122
|
||||||
|
f 108 137 77
|
||||||
|
f 137 138 77
|
||||||
|
f 31 152 123
|
||||||
|
f 31 153 152
|
||||||
|
f 138 167 77
|
||||||
|
f 167 168 77
|
||||||
|
f 31 182 153
|
||||||
|
f 31 183 182
|
||||||
|
f 168 197 77
|
||||||
|
f 197 198 77
|
||||||
|
f 31 212 183
|
||||||
|
f 31 213 212
|
||||||
|
f 198 227 77
|
||||||
|
f 227 228 77
|
||||||
|
f 31 242 213
|
||||||
|
f 213 242 241
|
||||||
|
f 213 241 214
|
||||||
|
f 214 241 240
|
||||||
|
f 214 240 215
|
||||||
|
f 215 240 216
|
||||||
|
f 240 239 216
|
||||||
|
f 216 239 238
|
||||||
|
f 216 238 217
|
||||||
|
f 217 238 218
|
||||||
|
f 238 237 218
|
||||||
|
f 218 237 219
|
||||||
|
f 237 236 219
|
||||||
|
f 219 236 235
|
||||||
|
f 219 235 220
|
||||||
|
f 220 235 234
|
||||||
|
f 220 234 221
|
||||||
|
f 221 234 233
|
||||||
|
f 221 233 222
|
||||||
|
f 222 233 232
|
||||||
|
f 222 232 223
|
||||||
|
f 223 232 224
|
||||||
|
f 232 231 224
|
||||||
|
f 224 231 230
|
||||||
|
f 224 230 225
|
||||||
|
f 225 230 226
|
||||||
|
f 230 229 226
|
||||||
|
f 226 229 228
|
||||||
|
f 226 228 227
|
||||||
|
f 199 226 227
|
||||||
|
f 199 227 198
|
||||||
|
f 200 225 199
|
||||||
|
f 225 226 199
|
||||||
|
f 201 224 225
|
||||||
|
f 201 225 200
|
||||||
|
f 202 223 201
|
||||||
|
f 223 224 201
|
||||||
|
f 203 222 223
|
||||||
|
f 203 223 202
|
||||||
|
f 204 221 222
|
||||||
|
f 204 222 203
|
||||||
|
f 205 220 221
|
||||||
|
f 205 221 204
|
||||||
|
f 206 219 220
|
||||||
|
f 206 220 205
|
||||||
|
f 207 218 206
|
||||||
|
f 218 219 206
|
||||||
|
f 208 217 207
|
||||||
|
f 217 218 207
|
||||||
|
f 209 216 217
|
||||||
|
f 209 217 208
|
||||||
|
f 210 215 209
|
||||||
|
f 215 216 209
|
||||||
|
f 211 214 215
|
||||||
|
f 211 215 210
|
||||||
|
f 212 213 214
|
||||||
|
f 212 214 211
|
||||||
|
f 183 212 211
|
||||||
|
f 183 211 184
|
||||||
|
f 184 211 210
|
||||||
|
f 184 210 185
|
||||||
|
f 185 210 186
|
||||||
|
f 210 209 186
|
||||||
|
f 186 209 208
|
||||||
|
f 186 208 187
|
||||||
|
f 187 208 188
|
||||||
|
f 208 207 188
|
||||||
|
f 188 207 189
|
||||||
|
f 207 206 189
|
||||||
|
f 189 206 205
|
||||||
|
f 189 205 190
|
||||||
|
f 190 205 204
|
||||||
|
f 190 204 191
|
||||||
|
f 191 204 203
|
||||||
|
f 191 203 192
|
||||||
|
f 192 203 202
|
||||||
|
f 192 202 193
|
||||||
|
f 193 202 194
|
||||||
|
f 202 201 194
|
||||||
|
f 194 201 200
|
||||||
|
f 194 200 195
|
||||||
|
f 195 200 199
|
||||||
|
f 195 199 196
|
||||||
|
f 196 199 198
|
||||||
|
f 196 198 197
|
||||||
|
f 169 196 197
|
||||||
|
f 169 197 168
|
||||||
|
f 170 195 169
|
||||||
|
f 195 196 169
|
||||||
|
f 171 194 195
|
||||||
|
f 171 195 170
|
||||||
|
f 172 193 171
|
||||||
|
f 193 194 171
|
||||||
|
f 173 192 193
|
||||||
|
f 173 193 172
|
||||||
|
f 174 191 192
|
||||||
|
f 174 192 173
|
||||||
|
f 175 190 191
|
||||||
|
f 175 191 174
|
||||||
|
f 176 189 190
|
||||||
|
f 176 190 175
|
||||||
|
f 177 188 176
|
||||||
|
f 188 189 176
|
||||||
|
f 178 187 177
|
||||||
|
f 187 188 177
|
||||||
|
f 179 186 187
|
||||||
|
f 179 187 178
|
||||||
|
f 180 185 179
|
||||||
|
f 185 186 179
|
||||||
|
f 181 184 185
|
||||||
|
f 181 185 180
|
||||||
|
f 182 183 184
|
||||||
|
f 182 184 181
|
||||||
|
f 153 182 181
|
||||||
|
f 153 181 154
|
||||||
|
f 154 181 180
|
||||||
|
f 154 180 155
|
||||||
|
f 155 180 156
|
||||||
|
f 180 179 156
|
||||||
|
f 156 179 178
|
||||||
|
f 156 178 157
|
||||||
|
f 157 178 158
|
||||||
|
f 178 177 158
|
||||||
|
f 158 177 159
|
||||||
|
f 177 176 159
|
||||||
|
f 159 176 175
|
||||||
|
f 159 175 160
|
||||||
|
f 160 175 174
|
||||||
|
f 160 174 161
|
||||||
|
f 161 174 173
|
||||||
|
f 161 173 162
|
||||||
|
f 162 173 172
|
||||||
|
f 162 172 163
|
||||||
|
f 163 172 164
|
||||||
|
f 172 171 164
|
||||||
|
f 164 171 170
|
||||||
|
f 164 170 165
|
||||||
|
f 165 170 166
|
||||||
|
f 170 169 166
|
||||||
|
f 166 169 167
|
||||||
|
f 169 168 167
|
||||||
|
f 139 166 138
|
||||||
|
f 166 167 138
|
||||||
|
f 140 165 166
|
||||||
|
f 140 166 139
|
||||||
|
f 141 164 140
|
||||||
|
f 164 165 140
|
||||||
|
f 142 163 141
|
||||||
|
f 163 164 141
|
||||||
|
f 143 162 163
|
||||||
|
f 143 163 142
|
||||||
|
f 144 161 162
|
||||||
|
f 144 162 143
|
||||||
|
f 145 160 161
|
||||||
|
f 145 161 144
|
||||||
|
f 146 159 160
|
||||||
|
f 146 160 145
|
||||||
|
f 147 158 146
|
||||||
|
f 158 159 146
|
||||||
|
f 148 157 147
|
||||||
|
f 157 158 147
|
||||||
|
f 149 156 157
|
||||||
|
f 149 157 148
|
||||||
|
f 150 155 149
|
||||||
|
f 155 156 149
|
||||||
|
f 151 154 150
|
||||||
|
f 154 155 150
|
||||||
|
f 152 153 154
|
||||||
|
f 152 154 151
|
||||||
|
f 123 152 151
|
||||||
|
f 123 151 124
|
||||||
|
f 124 151 150
|
||||||
|
f 124 150 125
|
||||||
|
f 125 150 126
|
||||||
|
f 150 149 126
|
||||||
|
f 126 149 148
|
||||||
|
f 126 148 127
|
||||||
|
f 127 148 128
|
||||||
|
f 148 147 128
|
||||||
|
f 128 147 129
|
||||||
|
f 147 146 129
|
||||||
|
f 129 146 145
|
||||||
|
f 129 145 130
|
||||||
|
f 130 145 144
|
||||||
|
f 130 144 131
|
||||||
|
f 131 144 143
|
||||||
|
f 131 143 132
|
||||||
|
f 132 143 142
|
||||||
|
f 132 142 133
|
||||||
|
f 133 142 134
|
||||||
|
f 142 141 134
|
||||||
|
f 134 141 135
|
||||||
|
f 141 140 135
|
||||||
|
f 135 140 136
|
||||||
|
f 140 139 136
|
||||||
|
f 136 139 138
|
||||||
|
f 136 138 137
|
||||||
|
f 109 136 137
|
||||||
|
f 109 137 108
|
||||||
|
f 110 135 109
|
||||||
|
f 135 136 109
|
||||||
|
f 111 134 110
|
||||||
|
f 134 135 110
|
||||||
|
f 112 133 111
|
||||||
|
f 133 134 111
|
||||||
|
f 113 132 133
|
||||||
|
f 113 133 112
|
||||||
|
f 114 131 132
|
||||||
|
f 114 132 113
|
||||||
|
f 115 130 131
|
||||||
|
f 115 131 114
|
||||||
|
f 116 129 130
|
||||||
|
f 116 130 115
|
||||||
|
f 117 128 116
|
||||||
|
f 128 129 116
|
||||||
|
f 118 127 117
|
||||||
|
f 127 128 117
|
||||||
|
f 119 126 127
|
||||||
|
f 119 127 118
|
||||||
|
f 120 125 119
|
||||||
|
f 125 126 119
|
||||||
|
f 121 124 125
|
||||||
|
f 121 125 120
|
||||||
|
f 122 123 124
|
||||||
|
f 122 124 121
|
||||||
|
f 93 122 121
|
||||||
|
f 93 121 94
|
||||||
|
f 94 121 120
|
||||||
|
f 94 120 95
|
||||||
|
f 95 120 96
|
||||||
|
f 120 119 96
|
||||||
|
f 96 119 118
|
||||||
|
f 96 118 97
|
||||||
|
f 97 118 98
|
||||||
|
f 118 117 98
|
||||||
|
f 98 117 99
|
||||||
|
f 117 116 99
|
||||||
|
f 99 116 115
|
||||||
|
f 99 115 100
|
||||||
|
f 100 115 101
|
||||||
|
f 115 114 101
|
||||||
|
f 101 114 113
|
||||||
|
f 101 113 102
|
||||||
|
f 102 113 112
|
||||||
|
f 102 112 103
|
||||||
|
f 103 112 104
|
||||||
|
f 112 111 104
|
||||||
|
f 104 111 110
|
||||||
|
f 104 110 105
|
||||||
|
f 105 110 106
|
||||||
|
f 110 109 106
|
||||||
|
f 106 109 108
|
||||||
|
f 106 108 107
|
||||||
|
f 79 106 78
|
||||||
|
f 106 107 78
|
||||||
|
f 80 105 79
|
||||||
|
f 105 106 79
|
||||||
|
f 81 104 105
|
||||||
|
f 81 105 80
|
||||||
|
f 82 103 81
|
||||||
|
f 103 104 81
|
||||||
|
f 83 102 103
|
||||||
|
f 83 103 82
|
||||||
|
f 84 101 102
|
||||||
|
f 84 102 83
|
||||||
|
f 85 100 84
|
||||||
|
f 100 101 84
|
||||||
|
f 86 99 100
|
||||||
|
f 86 100 85
|
||||||
|
f 87 98 86
|
||||||
|
f 98 99 86
|
||||||
|
f 88 97 87
|
||||||
|
f 97 98 87
|
||||||
|
f 89 96 97
|
||||||
|
f 89 97 88
|
||||||
|
f 90 95 89
|
||||||
|
f 95 96 89
|
||||||
|
f 91 94 95
|
||||||
|
f 91 95 90
|
||||||
|
f 92 93 94
|
||||||
|
f 92 94 91
|
||||||
|
f 62 92 91
|
||||||
|
f 62 91 63
|
||||||
|
f 63 91 90
|
||||||
|
f 63 90 64
|
||||||
|
f 64 90 65
|
||||||
|
f 90 89 65
|
||||||
|
f 65 89 88
|
||||||
|
f 65 88 66
|
||||||
|
f 66 88 67
|
||||||
|
f 88 87 67
|
||||||
|
f 67 87 68
|
||||||
|
f 87 86 68
|
||||||
|
f 68 86 85
|
||||||
|
f 68 85 69
|
||||||
|
f 69 85 84
|
||||||
|
f 69 84 70
|
||||||
|
f 70 84 83
|
||||||
|
f 70 83 71
|
||||||
|
f 71 83 82
|
||||||
|
f 71 82 72
|
||||||
|
f 72 82 73
|
||||||
|
f 82 81 73
|
||||||
|
f 73 81 80
|
||||||
|
f 73 80 74
|
||||||
|
f 74 80 75
|
||||||
|
f 80 79 75
|
||||||
|
f 75 79 78
|
||||||
|
f 75 78 76
|
||||||
|
f 48 75 76
|
||||||
|
f 48 76 47
|
||||||
|
f 49 74 48
|
||||||
|
f 74 75 48
|
||||||
|
f 50 73 49
|
||||||
|
f 73 74 49
|
||||||
|
f 51 72 50
|
||||||
|
f 72 73 50
|
||||||
|
f 52 71 72
|
||||||
|
f 52 72 51
|
||||||
|
f 53 70 71
|
||||||
|
f 53 71 52
|
||||||
|
f 54 69 70
|
||||||
|
f 54 70 53
|
||||||
|
f 55 68 69
|
||||||
|
f 55 69 54
|
||||||
|
f 56 67 55
|
||||||
|
f 67 68 55
|
||||||
|
f 57 66 56
|
||||||
|
f 66 67 56
|
||||||
|
f 58 65 66
|
||||||
|
f 58 66 57
|
||||||
|
f 59 64 58
|
||||||
|
f 64 65 58
|
||||||
|
f 60 63 64
|
||||||
|
f 60 64 59
|
||||||
|
f 61 62 63
|
||||||
|
f 61 63 60
|
||||||
|
f 32 61 60
|
||||||
|
f 32 60 33
|
||||||
|
f 33 60 59
|
||||||
|
f 33 59 34
|
||||||
|
f 34 59 58
|
||||||
|
f 34 58 35
|
||||||
|
f 35 58 57
|
||||||
|
f 35 57 36
|
||||||
|
f 36 57 56
|
||||||
|
f 36 56 37
|
||||||
|
f 37 56 38
|
||||||
|
f 56 55 38
|
||||||
|
f 38 55 54
|
||||||
|
f 38 54 39
|
||||||
|
f 39 54 53
|
||||||
|
f 39 53 40
|
||||||
|
f 40 53 52
|
||||||
|
f 40 52 41
|
||||||
|
f 41 52 51
|
||||||
|
f 41 51 42
|
||||||
|
f 42 51 43
|
||||||
|
f 51 50 43
|
||||||
|
f 43 50 44
|
||||||
|
f 50 49 44
|
||||||
|
f 44 49 45
|
||||||
|
f 49 48 45
|
||||||
|
f 45 48 46
|
||||||
|
f 48 47 46
|
||||||
|
f 17 45 16
|
||||||
|
f 45 46 16
|
||||||
|
f 18 44 17
|
||||||
|
f 44 45 17
|
||||||
|
f 19 43 44
|
||||||
|
f 19 44 18
|
||||||
|
f 20 42 43
|
||||||
|
f 20 43 19
|
||||||
|
f 21 41 42
|
||||||
|
f 21 42 20
|
||||||
|
f 22 40 41
|
||||||
|
f 22 41 21
|
||||||
|
f 23 39 40
|
||||||
|
f 23 40 22
|
||||||
|
f 24 38 39
|
||||||
|
f 24 39 23
|
||||||
|
f 25 37 24
|
||||||
|
f 37 38 24
|
||||||
|
f 26 36 37
|
||||||
|
f 26 37 25
|
||||||
|
f 27 35 36
|
||||||
|
f 27 36 26
|
||||||
|
f 28 34 35
|
||||||
|
f 28 35 27
|
||||||
|
f 29 33 34
|
||||||
|
f 29 34 28
|
||||||
|
f 30 32 33
|
||||||
|
f 30 33 29
|
||||||
|
f 1 30 29
|
||||||
|
f 1 29 2
|
||||||
|
f 2 29 28
|
||||||
|
f 2 28 3
|
||||||
|
f 3 28 27
|
||||||
|
f 3 27 4
|
||||||
|
f 4 27 26
|
||||||
|
f 4 26 5
|
||||||
|
f 5 26 25
|
||||||
|
f 5 25 6
|
||||||
|
f 6 25 7
|
||||||
|
f 25 24 7
|
||||||
|
f 7 24 23
|
||||||
|
f 7 23 8
|
||||||
|
f 8 23 22
|
||||||
|
f 8 22 9
|
||||||
|
f 9 22 21
|
||||||
|
f 9 21 10
|
||||||
|
f 10 21 20
|
||||||
|
f 10 20 11
|
||||||
|
f 11 20 12
|
||||||
|
f 20 19 12
|
||||||
|
f 12 19 18
|
||||||
|
f 12 18 13
|
||||||
|
f 13 18 14
|
||||||
|
f 18 17 14
|
||||||
|
f 14 17 16
|
||||||
|
f 14 16 15
|
||||||
|
f 229 14 15
|
||||||
|
f 229 15 228
|
||||||
|
f 230 13 14
|
||||||
|
f 230 14 229
|
||||||
|
f 231 12 13
|
||||||
|
f 231 13 230
|
||||||
|
f 232 11 12
|
||||||
|
f 232 12 231
|
||||||
|
f 233 10 11
|
||||||
|
f 233 11 232
|
||||||
|
f 234 9 10
|
||||||
|
f 234 10 233
|
||||||
|
f 235 8 9
|
||||||
|
f 235 9 234
|
||||||
|
f 236 7 235
|
||||||
|
f 7 8 235
|
||||||
|
f 237 6 236
|
||||||
|
f 6 7 236
|
||||||
|
f 238 5 237
|
||||||
|
f 5 6 237
|
||||||
|
f 239 4 238
|
||||||
|
f 4 5 238
|
||||||
|
f 240 3 239
|
||||||
|
f 3 4 239
|
||||||
|
f 241 2 240
|
||||||
|
f 2 3 240
|
||||||
|
f 242 1 241
|
||||||
|
f 1 2 241
|
||||||
Reference in new issue
Block a user