Monday, December 29, 2008

PointSet demo

Here are three points. Note they are all on a plane (coords are given as triplets X Y Z and Z is zero for all).
#VRML V2.0 utf8

Shape {
  geometry PointSet {
    color Color {
      color [
        1.0 0.0 0.0,
        0.0 1.0 0.0,
        0.0 0.0 1.0
      ]
    }
coord Coordinate {
      point [
        -1.0 -1.0 0.0,
        1.0 1.0 0.0,
        0.0 0.0 0.0
      ]
    }
  }
}
Three not aligned points in space. Note when no color is specified the default color is the emissive color from this node. Since default emissive color and background are black we need to change one of them or we won't be able to see the points.
#VRML V2.0 utf8

Shape {
  appearance Appearance {
    material Material {
      emissiveColor 1 1 1
    }
  }

  geometry PointSet {
    coord Coordinate {
      point [ -1 -1 0, 0 2 1, 1 0 -1 ]
    }
  }
}

No comments: