Clip Planes

Contents

Introduction

A clip plane temporarily cuts through the scene and shows the cross-section of the scene. A clip plane is represented by:

A clip plane is represented by a point & 3 vectors

A clip plane extends to infinity. You can use up to 6 clip planes.

Enabling a clip plane

To use a clip plane, we do the following steps:

  1. get a clip plane,
  2. show the clip plane (optional, useful during development),
  3. enable the clip plane.
A clip plane: (left) clipping is disabled; (right) clipping is enabled
// Callback function that will be called after building is loaded
function LoadOkCallback()
{
	// Get a clip plane
	var cplane = germ.GetClipPlane(0);
 
	// Show the clip plane
	cplane.Show();
 
	// Enable the clip plane
	cplane.EnableClipping();
}
 
// Load a building
germ.Load("http://www.germanium3d.com/static/sample/generic_building/generic_building.xlcl",
	null, LoadOkCallback);

When enabled, a hidden clip plane still cuts the scene.

Adjusting position & orientation

You can adjust a clip plane through the API:

var cplane = germ.GetClipPlane(0);
cplane.Show();
 
// Adjust clip plane
cplane.SetPosition(10, 0, 0);
cplane.SetOrientation(0, Germanium.DegreeToRadian(45), Germanium.DegreeToRadian(10));

The following code demonstrates that you can achieve the equivalent of SetOrientation() using RotateAroundRightVector(), RotateAroundUpVector(), & RotateAroundNormalVector().

var cplane = germ.GetClipPlane(1);
cplane.Show();
 
// Adjust clip plane
cplane.Move(germ.CreateVector3(0, 0, -10));
cplane.SetNormal(0, 0, 1);
cplane.RotateAroundRightVector(0);				// X component of SetOrientation()
cplane.RotateAroundUpVector(Germanium.DegreeToRadian(45));	// Y component
cplane.RotateAroundNormalVector(Germanium.DegreeToRadian(10));	// Z component
 
cplane.EnableClipping();	// make this clip plane look different from the one in previous example
Tip: Refer to the Coordinate System article to learn how GermaniumWeb represents position.

Reference

ClipPlane

Retrieved from "http://www.germanium3d.com/code/ClipPlaneConcepts"

This page has been accessed 38,876 times. This page was last modified on 30 April 2010, at 02:42.


Developers


Main

API Key Registration

Developer Guide
- Introduction
- Buildings
- Point Placemarks
- Line & Polygon      PlacemarksUpdated
- Model Placemarks New
- HTMLBoxes New
- Eye Control
- Clip Planes
- Events
- Coordinate System
- Navigation Modes
- Options

API Documentation

Examples
- Applications Gallery
- Hello Germanium
- Interactive samples

More Resources
- API Release Notes
- Developer FAQ
- "A Beginner's Guide" slides
- Training Materials
- Icon Gallery
- Sample Buildings
- BBL Tree

Report Bugs