23 20 MBD7W5FSRG2UG2MEGSYYCAFT6D7GSZ2TF7W62OY

The Point subclass Example 23.20: The Point subclass Example 23.20 is a point class. A point has position but not much else so all it needs to add to shape is an implementation of draw. For good measure we'll also throw in a simple constructor that takes the location of the Point. This will be quite useful in many cases, even though it's not absolutely necessary. package elharo.vrml; public class Point extends shape { public Point(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } public String draw() { String node1 = "Coordinate3 { point [ "; String node2 = x + " " + y + " " + z; String node3 = "] }\n\n"; String node4 = "PointSet {\n " + "startIndex 0\n numPoints 1\n}"; return node1 + node2 + node3 + node4; } } Copyright 1996 Elliotte Rusty Harold elharo@sunsite.unc.edu This Chapter Examples Home
Wyszukiwarka

Podobne podstrony:
20 00 23 ob6uud4x3kwyluddtsbdkydna3vdqmgrlnbbjxq
2008 Metody obliczeniowe 06 D 2008 10 22 20 13 23
II 4 Biesaga T Etyka cnót w etyce medycznej MP 32006 20 23
20 (23)
20 23 Grudzień 1997 Polacy porwani

więcej podobnych podstron