001package org.vishia.gral.ifc; 002 003import org.vishia.gral.base.GralPos; 004 005/**A GralPoint contains 2 or 3 float values for a point. 006 * The unit of float is 1 grid unit like {@link GralPos}. It means, a figure described with this points 007 * is shown in the correct size. Fractional parts of float determines fine positions. 008 * The third dimension can be used for 3-dimensional figures. 009 * @author Hartmut Schorrig 010 * 011 */ 012public class GralPoint 013{ 014 /**Version, history and license. 015 * <ul> 016 * <li>2011-06-00 Hartmut created 017 * </ul> 018 * 019 * <b>Copyright/Copyleft</b>:<br> 020 * For this source the LGPL Lesser General Public License, 021 * published by the Free Software Foundation is valid. 022 * It means: 023 * <ol> 024 * <li> You can use this source without any restriction for any desired purpose. 025 * <li> You can redistribute copies of this source to everybody. 026 * <li> Every user of this source, also the user of redistribute copies 027 * with or without payment, must accept this license for further using. 028 * <li> But the LPGL is not appropriate for a whole software product, 029 * if this source is only a part of them. It means, the user 030 * must publish this part of source, 031 * but doesn't need to publish the whole source of the own product. 032 * <li> You can study and modify (improve) this source 033 * for own using or for redistribution, but you have to license the 034 * modified sources likewise under this LGPL Lesser General Public License. 035 * You mustn't delete this Copyright/Copyleft inscription in this source file. 036 * </ol> 037 * If you intent to use this source without publishing its usage, you can get 038 * a second license subscribing a special contract with the author. 039 * 040 * @author Hartmut Schorrig = hartmut.schorrig@vishia.de 041 */ 042 public static final int version = 20120422; 043 044 public final float x,y,z; 045 046 public GralPoint(float x, float y) 047 { this.x = x; this.y = y; this.z = Float.NaN; 048 } 049 050 public GralPoint(float x, float y, float z) 051 { this.x = x; this.y = y; this.z = z; 052 } 053 054 @Override public String toString(){ 055 if(z == Float.NaN) return "Point(" + x + ":" + y + ")"; 056 else return "Point(" + x + ":" + y + ":" + z + ")"; 057 } 058 059}