aboutsummaryrefslogtreecommitdiff
path: root/tool_src/BspLib/Mapping.cpp
blob: 956d66c84d1289a2115418d2d88b86f4ef8a1167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//-----------------------------------------------------------------------------
//	BSPLIB MODULE: Mapping.cpp
//
//  Copyright (c) 1996-1998 by Markus Hadwiger
//  All Rights Reserved.
//-----------------------------------------------------------------------------

// bsplib headers
#include "Mapping.h"
#include "Chunk.h"


BSPLIB_NAMESPACE_BEGIN


// write mapping info in vertexindexes with mappings format -------------------
//
void Mapping::WriteMappingInfo( FILE *fp ) const
{
	// write list of vertex indexes
	int i = 0;
	for (  i = 0; i < numvertexindxs; i++ ) {
		fprintf( fp, ( i == numvertexindxs - 1 ) ?
			"%d\n" : "%d, ", facevertexindxs[ i ] + 1 );
	}

	// write (u,v) coordinates
	for ( i = 0; i < numvertexindxs; i++ ) {
		fprintf( fp, "%f, \t%f\n",
				mappingcoordinates[ i ].getX(),
				mappingcoordinates[ i ].getY() );
	}

	fprintf( fp, "\n" );
}


// error in search of vertices ------------------------------------------------
//
void Mapping::Error( int vertindx )
{
	char *line = new char[ 1024 ];
//	fprintf( stderr, "***ERROR*** Correspondence not found (%d)!\n", corrno + 1 );
	sprintf( line, "***ERROR*** Correspondence not found!\nsought vertex %d", vertindx + 1 );
	ErrorMessage( line );
	delete line;
/*
	fprintf( stderr, "list of vertices:\n" );
	for ( int i = 0; i < numvertexindxs; i++ )
		fprintf( stderr, "vertex %d\n", facevertexindxs[ i ] + 1 );
*/
	HandleCriticalError();
}


// size of mapping chunk ------------------------------------------------------
//
template <> const int ChunkRep<Mapping>::CHUNK_SIZE = 256;


BSPLIB_NAMESPACE_END

//-----------------------------------------------------------------------------