jhplot
Class P3D
- java.lang.Object
-
- jhplot.Plottable
-
- jhplot.P3D
-
- All Implemented Interfaces:
- java.io.Serializable
public class P3D extends Plottable implements java.io.Serializable
A container to hold data points in X,Y,Z and their extensions dX,dY,dZ. Use this class to draw a surface segment- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description P3D()Construct an empty containerP3D(java.lang.String title)Construct an empty container with a titleP3D(java.lang.String title, java.lang.String sfile)Construct a P3D from a file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(double x, double dx, double y, double dy, double z, double dz)Adds values of a plot-point pair (X,dX,Y,dY,Z,dZ).voidclear()Clear the containervoiddoc()Show online documentation.double[]getArrayX()Get array representing X-valuesdouble[]getArrayY()Get array representing Y-valuesdouble[]getArrayZ()Get array representing Z-valuesP3DgetCopy()get a copy of the current holderjplot.DataArray3DgetDataArray()Return a DataArray3D container.doublegetDX(int i)Return a specific dX-value.doublegetDY(int i)Return a specific dY-value.doublegetDZ(int i)Return a specific dZ-value.doublegetMax(int axis)Returns the maximum value in the range.doublegetMin(int axis)Returns the minimum value in the range.java.awt.ColorgetPenColor()Get the color attributeintgetPenWidth()Get width of the linesjava.lang.StringgetTitle()Get a new titledoublegetX(int i)Return a specific X-value.doublegetY(int i)Return a specific Y-value.doublegetZ(int i)Return a specific Z-value.doublemeanX()Returns the mean value in X.doublemeanY()Returns the mean value in Y.doublemeanZ()Returns the mean value in Z.P3Dmerge(P3D a)Merge two P3D containersvoidprint()Print a P3D container on the screenintread(java.lang.String sfile)Read P3D from a file.intreadGZip(java.lang.String sfile)Read P3D from a GZipped file.P3DreadSerialized(java.lang.String name)Read a P3D object from a serialized fileintreadZip(java.lang.String sfile)Read P3D from a Zipped file.voidset(int i, double x, double dx, double y, double dy, double z, double dz)Sets the values of (x,dx,y,dy,z,dz).voidsetDataArray(jplot.DataArray3D data)Set data in a form of DataArrayvoidsetPenColor(java.awt.Color c)Sets the symbol colorvoidsetPenWidth(int w)Set width of the linesvoidsetTitle(java.lang.String title)Set a new titleintsize()Return the length of the data vector.voidtoFile(java.lang.String name)Write a P3D to an external file.voidtoTable()Print the P2D container to a Table in a separate Frame.intwriteSerialized(java.lang.String name)Write a P0D object to a serialized file
-
-
-
Constructor Detail
-
P3D
public P3D()
Construct an empty container
-
P3D
public P3D(java.lang.String title)
Construct an empty container with a title- Parameters:
title- New title
-
P3D
public P3D(java.lang.String title, java.lang.String sfile)Construct a P3D from a file. Data should be separated by space in 6 columns: X,dX,Y,dY,Z,dZ- Parameters:
title- Title of the containersfile- File name with input
-
-
Method Detail
-
setTitle
public void setTitle(java.lang.String title)
Set a new title
-
getTitle
public java.lang.String getTitle()
Get a new title
-
getPenColor
public java.awt.Color getPenColor()
Get the color attribute- Returns:
- Color
-
setPenColor
public void setPenColor(java.awt.Color c)
Sets the symbol color- Parameters:
c- Color
-
setPenWidth
public void setPenWidth(int w)
Set width of the lines- Parameters:
w- Width of the lines
-
getPenWidth
public int getPenWidth()
Get width of the lines- Returns:
- Width of the lines
-
read
public int read(java.lang.String sfile)
Read P3D from a file. The old content will be lost. The file should contain 6 columns: x,y,z, dx,dy,dz. Comment lines starting with "#" and "*" are ignored.- Parameters:
sfile- File name with input- Returns:
- zero if success
-
writeSerialized
public int writeSerialized(java.lang.String name)
Write a P0D object to a serialized file- Parameters:
name- serialized file name for output.- Returns:
- zero if no errors
-
readSerialized
public P3D readSerialized(java.lang.String name)
Read a P3D object from a serialized file- Parameters:
name- serialized file name for input.- Returns:
- new P3D object
-
readGZip
public int readGZip(java.lang.String sfile)
Read P3D from a GZipped file. The old content will be lost. The file should contain 6 columns: x,y,z, dx,dy,dz. Comment lines starting with "#" and "*" are ignored.- Parameters:
sfile- File name with input- Returns:
- zero if success
-
readZip
public int readZip(java.lang.String sfile)
Read P3D from a Zipped file. The old content will be lost. The file should contain 6 columns: x,y,z, dx,dy,dz. Comment lines starting with "#" and "*" are ignored.- Parameters:
sfile- File name with input- Returns:
- zero if success
-
toFile
public void toFile(java.lang.String name)
Write a P3D to an external file.- Parameters:
name- File name with output
-
print
public void print()
Print a P3D container on the screen
-
merge
public P3D merge(P3D a)
Merge two P3D containers- Parameters:
a- Container to be added- Returns:
- New P3D container
-
setDataArray
public void setDataArray(jplot.DataArray3D data)
Set data in a form of DataArray- Parameters:
data- input data
-
getDataArray
public jplot.DataArray3D getDataArray()
Return a DataArray3D container.- Returns:
- Container of type DataArray3D
-
add
public void add(double x, double dx, double y, double dy, double z, double dz)Adds values of a plot-point pair (X,dX,Y,dY,Z,dZ).- Parameters:
x- X-value of the plot-pointdx- extent in Xy- Y-value of the plot-pointdy- extent in Yz- Z-value of the plot-pointdz- extent in Z
-
set
public void set(int i, double x, double dx, double y, double dy, double z, double dz)Sets the values of (x,dx,y,dy,z,dz).- Parameters:
i- index of the plot-pointx- X-value of the plot-pointdx- extent in Xy- Y-value of the plot-pointdy- extent in Yz- Z-value of the plot-pointdz- extent in Z
-
size
public int size()
Return the length of the data vector.- Returns:
- length of the PlotPoint vector
-
getCopy
public P3D getCopy()
get a copy of the current holder
-
getArrayX
public double[] getArrayX()
Get array representing X-values- Returns:
- array with X values
-
getArrayY
public double[] getArrayY()
Get array representing Y-values- Returns:
- array with Y values
-
getArrayZ
public double[] getArrayZ()
Get array representing Z-values- Returns:
- array with Y values
-
getX
public double getX(int i)
Return a specific X-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of x at index i
-
getDX
public double getDX(int i)
Return a specific dX-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of dx at index i
-
getY
public double getY(int i)
Return a specific Y-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of y at index i
-
getDY
public double getDY(int i)
Return a specific dY-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of dy at index i
-
getZ
public double getZ(int i)
Return a specific Z-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of z at index i
-
getDZ
public double getDZ(int i)
Return a specific dZ-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i- index of the array- Returns:
- the value of dz at index i
-
getMax
public double getMax(int axis)
Returns the maximum value in the range.- Parameters:
axis- defines to which axis this function applies. axis=0 - X, axis=1 - Y, axis=2 - Z,- Returns:
- the maximum value.
-
getMin
public double getMin(int axis)
Returns the minimum value in the range. axis=0 - X, axis=1 - Y, axis=2 - Z.- Parameters:
axis- defines to which axis this function applies.- Returns:
- the minimum value.
-
meanX
public double meanX()
Returns the mean value in X.- Returns:
- Mean value in X
-
meanY
public double meanY()
Returns the mean value in Y.- Returns:
- Mean value in Y
-
meanZ
public double meanZ()
Returns the mean value in Z.- Returns:
- Mean value in Y
-
clear
public void clear()
Clear the container
-
toTable
public void toTable()
Print the P2D container to a Table in a separate Frame. The numbers are formatted to scientific format. One can sort and search the data in this table (but not modify)
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG