Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Displaying 3D Objects (d3_window)

Displaying 3D Objects (d3_window)

The data type d3_window supports three dimensional visualization. It uses a window to visualize and animate three-dimensional graphs. If the graph is a planar map, the faces are drawn in different grey scales.

Example: 3D Convex Hull

The following program uses a d3_window to visualize the convex hull of a set of three-dimensional points.

On the right you see a screenshot of the program. Clicking on the picture shows it in original size.

Picture of Convex Hull

#include <LEDA/graphics/window.h>
#include <LEDA/geo/d3_hull.h>
#include <LEDA/graphics/d3_window.h>
#include <LEDA/geo/random_rat_point.h>

using namespace leda;

int main()
  //construct a random set of points L
  list<d3_rat_point> L;

  //construct convex hull H of L in 3D
  GRAPH<d3_rat_point,int> H;

  //open a window W
  window W(400,400,"d3 hull demo");
  //extract the node positions into an array of vectors
  node_array<rat_vector> pos(H);
  node v;
  forall_nodes(v,H) pos[v]=H[v].to_vector();

  //and display H in a d3_window for window W
  d3_window d3win(W,H,pos);

  return 0;

See also:

Windows and Panels


Planar Maps

Convex Hulls

Basic Data Types for 3D Geometry

Manual Pages:

Manual Page Windows

Manual Page Panels

Manual Page 3D Convex Hull Algorithms

Please send any suggestions, comments or questions to
© Copyright 2001-2003, Algorithmic Solutions Software GmbH