source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/march/init.cc @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 2.0 KB
Line 
1/*
2
3Name:         init.c
4
5Coded:        Paul Ning
6
7Modified by:  Brian Curless
8              Computer Graphics Laboratory
9              Stanford University
10
11Comment:      Initialize some global variables.
12
13Copyright (1997) The Board of Trustees of the Leland Stanford Junior
14University. Except for commercial resale, lease, license or other
15commercial transactions, permission is hereby given to use, copy,
16modify this software for academic purposes only.  No part of this
17software or any derivatives thereof may be used in the production of
18computer models for resale or for use in a commercial
19product. STANFORD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND
20CONCERNING THIS SOFTWARE.  No support is implied or provided.
21
22*/
23
24
25#include <stdio.h>
26#include <string.h>
27#include <math.h>
28#include "mc.h"
29#include <unistd.h>
30
31void Init()
32{
33  char OutMCFileName[PATH_MAX+3];
34  int outlength;
35  float maxsize;
36
37  /*
38   * Read the EdgeTable file
39   */
40  InitEdgeTable();
41
42  occGrid = new OccGridRLE(10,10,10,CHUNK_SIZE);
43  if (!(occGrid->read(infile))) {
44      printf("Cannot open file %s for reading\n",infile);
45      exit(-1);
46  }
47
48
49  dx = dy = dz = occGrid->resolution;
50
51  printf("Resolution = %f\n", dx);
52
53  Nx = occGrid->zdim;
54  Ny = occGrid->xdim;
55  Nz = occGrid->ydim;
56
57  i1 = Nx - 2;
58  j_1 = Ny - 2;
59  k1 = Nz - 2;
60
61  /*
62   * Initialize some variables
63   */
64  outlength = strlen(outfile);
65  strcpy(OutMCFileName,outfile);
66  sprintf(&(OutMCFileName[outlength]),".mc");
67
68  maxsize = Nx*dx;
69  if (Ny*dy > maxsize) maxsize = Ny*dy;
70  if (Nz*dz > maxsize) maxsize = Nz*dz;
71  FtoSScale = maxsize/65520.0;
72  NrmMagScale = sqrt((double) 1/(dx*dx)+1/(dy*dy)+1/(dz*dz)) * 255.0/2.0/254.0;
73
74  xstart = Nx/2.0*dx + occGrid->origin[2];
75  ystart = Ny/2.0*dy + occGrid->origin[0];
76  zstart = Nz/2.0*dz + occGrid->origin[1];
77
78  xstart = 0;
79  ystart = 0;
80  zstart = 0;
81
82
83  /*
84   * Initialize the output file
85   */
86
87
88/*
89  if (!(OutMCFile = fopen(OutMCFileName,"w")))
90    Fatal("Cannot open MC file for writing");
91
92  MC_InitHeader(OutMCFile);
93*/
94
95}  /* Init */
96
97
Note: See TracBrowser for help on using the repository browser.