Search:

## Trail

A trail is a two-dimensional drawable that displays a collection of points in the plane. The points are added to the trail either through the Input X and Input Y properties, or using the element’s addPoint or moveToPoint methods. The points are displayed using lines which connect the points, each with the previous one, thus forming a polygonal line (which looks like a trail). The trail can be disconnected at some points if the Connected property is set temporarily to false, of if the moveToPoint method is used. The number of points in a trail can be limited through the Max Points property. Adding points past the limit causes the trail to remove the first points in it.

Click on the image to start the applet.

A simple Trail2D example: the Input properties of two 2D trails are used to plot the solution curves of a second order differential equation. Download this example.

Trails can be broken into several segments using the newSegment method. Each segment behaves like a sub-trail, but segments can have different drawing styles (line width and color). Also, the user can delete the points in the last segment without affecting the previous segments.

Click on the image to start the applet.

A more sophisticated Trail2D example: the addPoint() and moveToPoint() methods of a 2D trail are used to create separated plots for parametric curves of the plane. Download this example.

## Properties

Property values in the 2D Trail inspector

## Public methods of the 2D Trail element that can be invoked in a code page

 Signature and description void addPoint(double x, double y). Adds a new point (x,y) to the trail. The point is connected to the previous point, if the Connected property is set to true. The following sample code displays the graph of the sine function in the interval [0,2 Pi] using a Trail2D element called trail:double tMin = 0, tMax = 2*Math.PI;int nPoints = 100;for (int i=0; i

Page last modified on December 07, 2010, at 01:17 PM