Code Examples
A repository of 155 code examples for BeepBeep
|
Calculate the Euclidean distance of each two successive points in an input trace of (x,y) coordinates. More...
Classes | |
class | Distance |
We create a new function: Distance. | |
class | Point |
Static Public Member Functions | |
static void | main (String[] args) |
static Object [] | getListOfPoints () |
Creates a dummy array of points. More... | |
Calculate the Euclidean distance of each two successive points in an input trace of (x,y) coordinates.
For two points (x1,y1) and (x2,y2), the Euclidean distance is defined as the square root of (x1-x2)2 + (y1-y2)2. The chain of processors in this example can be represented graphically as:
In this picture, light green pipes correspond to streams of Point objects. The processor with a ruler and a "d" is the Distance processor defined below.
On an input stream made of points (2,7), (1,8), (2,8), (1,8), …, the expected output of this program should look like:
1.4142135 1.0 1.0 1.0 3.6055512 …
Definition at line 60 of file PointDistance.java.
|
static |
Creates a dummy array of points.
Definition at line 139 of file PointDistance.java.