File: main.cpp

package info (click to toggle)
mercator 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,008 kB
  • sloc: sh: 10,433; cpp: 4,482; makefile: 115
file content (54 lines) | stat: -rw-r--r-- 1,553 bytes parent folder | download | duplicates (7)
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
// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2003 Damien McGinnes, Alistair Riddoch

#include <Mercator/Segment.h>
#include <Mercator/Terrain.h>
#include <Mercator/Matrix.h>
#include <Mercator/BasePoint.h>

#include <iostream>

int main() 
{
    int size = 64;
    Mercator::Segment *s = new Mercator::Segment(0, 0, size);

    Mercator::Matrix<2, 2, Mercator::BasePoint> & base = s->getControlPoints();
    base[0] = Mercator::BasePoint(10.f, 3.f);
    base[1].height() = 15.f;
    base[2] = Mercator::BasePoint(10.f, 10.f);
    base[3] = Mercator::BasePoint(9.32f, 1.9f);
    
    s->populate();
/*    s->populateNormals(); 

    float *n=s->getNormals();
i*/    //for (int i=0; i<=size; ++i) {
        int i=0;
        for (int j=0; j<=size; ++j) {
                std::cout <<  j << ":" << s->get(i,j) << ", " ;
        }
       //}
/*          std::cout << s->get(i,j) << " ; ";
            std::cout << n[j * size * 3 + i * 3 ] << " : ";
            std::cout << n[j * size * 3 + i * 3 + 1] << " : ";
            std::cout << n[j * size * 3 + i * 3 + 2];
            std::cout << std::endl;
        }
            std::cout << std::endl;
    }
*/

    Mercator::Terrain t;
    t.setBasePoint(0,0,10.0);
    t.setBasePoint(0,1,12.0);
    t.setBasePoint(1,0,14.0);
    t.setBasePoint(1,1,16.0);
    std::cout << t.getSegment(0,0);
    t.setBasePoint(1,1,12.0);
    std::cout << t.getSegment(0,0);
    std::cout << std::endl;
    
    return 0;
}