File: space_minimal.cpp

package info (click to toggle)
meshlab 1.3.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,900 kB
  • ctags: 33,325
  • sloc: cpp: 224,813; ansic: 8,170; xml: 119; makefile: 78
file content (42 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (5)
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
#include <stdio.h>
#include<vcg/math/base.h>
#include<vcg/space/point3.h>
#include<vcg/space/point4.h>
#include<vcg/space/color4.h>

using namespace vcg;
// The shortest, simplest, dulliest introduction to the VCG Library
int main(int argc, char *argv[])
{
  printf("Hello Library!\n");

  // classical point types. 
  // Point3f is just a typedef for Point3<float>
  Point3f pp0(0,1,2);
  Point3f pp1(2,1,0);

  // classical overloading of math operators
  Point3f pp2=pp1+pp0;

  //you can access to the components of a point with three different access methods
  // [0] [1] [2]            <-- Preferred style
  // .X() .Y() .Z()
  // .V(0) .V(1) .V(2)
  printf("pp2: %f %f %f \n",pp2[0], pp2.Y(),pp2.V(2));
  
  // Warning no implicit casts between different types
  // Conversions are explicit
  Point3i ppi=Point3i::Construct(pp1+pp0);
  
  Point4i size(0,0,1,1);
  
  // Colors are specialized Point4<unsigned char> 
  // with a specialized constructor 

  Color4b cb(Color4b::LightBlue);   
  Color4f cf(Color4f::LightBlue);

  Color4b cbi; cbi.Import(cf);
  printf("ci %i %i %i %i\n",cbi.V(0),cbi.V(1),cbi.V(2),cbi.V(3));
  return -1;
}