// // Linear3DSet.java // /* VisAD system for interactive analysis and visualization of numerical data. Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and Tommy Jasmin. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ package visad; /** Linear3DSet represents a finite set of samples of R^3 in a cross product of three arithmetic progressions.is a Linear3DSet and each * of the Linear1DSet-s that make up this cross product * are equal. */ public boolean equals(Object set) { if (!(set instanceof Linear3DSet) || set == null) return false; if (this == set) return true; if (!equalUnitAndCS((Set) set)) return false; return (X.equals(((Linear3DSet) set).getX()) && Y.equals(((Linear3DSet) set).getY()) && Z.equals(((Linear3DSet) set).getZ())); } /** * Returns the hash code for this instance. * @return The hash code for this instance. */ public int hashCode() { if (!hashCodeSet) { hashCode = unitAndCSHashCode() ^ X.hashCode() ^ Y.hashCode() ^ Z.hashCode(); hashCodeSet = true; } return hashCode; } /** * Get the indexed component (X is at 0, Y is at 1, and Z is at 2) * * @param i Index of component * @return The requested component * @exception ArrayIndexOutOfBoundsException If an invalid index is * specified. */ public Linear1DSet getLinear1DComponent(int i) { if (i == 0) return getX(); else if (i == 1) return getY(); else if (i == 2) return getZ(); else throw new ArrayIndexOutOfBoundsException("Invalid component index"); } /** * Return a clone of this object with a new MathType. * @param type new MathType. * @return new Linear3DSet withThe order of the samples is the rasterization of the orders of the 1D components, with the first component increasing fastest. For more detail, see the example in Linear2DSet.java.
*/ public class Linear3DSet extends Gridded3DSet implements LinearSet { Linear1DSet X, Y, Z; private boolean cacheSamples; /** * Construct a 3-D cross product of
setswith a * generic MathType. * @param sets Linear1DSets that make up this Linear3DSet. * @throws VisADException illegal sets or other VisAD error. */ public Linear3DSet(Linear1DSet[] sets) throws VisADException { this(RealTupleType.Generic3D, sets, null, null, null); } /** * Construct a 3-D cross product ofsetswith the * specifiedtype. * @param type MathType for this Linear3DSet. Must be consistent * with MathType-s of sets. * @param sets Linear1DSets that make up this Linear3DSet. * @throws VisADException illegal sets or other VisAD error. */ public Linear3DSet(MathType type, Linear1DSet[] sets) throws VisADException { this(type, sets, null, null, null); } /** * Construct a 3-D cross product of arithmetic progressions with * null errors and generic type. * @param first1 first value in first arithmetic progression * @param last1 last value in first arithmetic progression * @param length1 number of values in first arithmetic progression * @param first2 first value in second arithmetic progression * @param last2 last value in second arithmetic progression * @param length2 number of values in second arithmetic progression * @param first3 first value in third arithmetic progression * @param last3 last value in third arithmetic progression * @param length3 number of values in third arithmetic progression * @throws VisADException problem creating VisAD objects. */ public Linear3DSet(double first1, double last1, int length1, double first2, double last2, int length2, double first3, double last3, int length3) throws VisADException { this(RealTupleType.Generic3D, LinearNDSet.get_linear1d_array(RealTupleType.Generic3D, first1, last1, length1, first2, last2, length2, first3, last3, length3, null), null, null, null); } /** * Construct a 3-D cross product of arithmetic progressions with * null errors and the specifiedtype. * @param type MathType for this Linear3DSet. * @param first1 first value in first arithmetic progression * @param last1 last value in first arithmetic progression * @param length1 number of values in first arithmetic progression * @param first2 first value in second arithmetic progression * @param last2 last value in second arithmetic progression * @param length2 number of values in second arithmetic progression * @param first3 first value in third arithmetic progression * @param last3 last value in third arithmetic progression * @param length3 number of values in third arithmetic progression * @throws VisADException problem creating VisAD objects. */ public Linear3DSet(MathType type, double first1, double last1, int length1, double first2, double last2, int length2, double first3, double last3, int length3) throws VisADException { this(type, LinearNDSet.get_linear1d_array(type, first1, last1, length1, first2, last2, length2, first3, last3, length3, null), null, null, null); } /** * Construct a 3-D cross product of arithmetic progressions with * the specifiedtype,coord_sys, *unitsanderrors. * @param type MathType for this Linear3DSet. * @param first1 first value in first arithmetic progression * @param last1 last value in first arithmetic progression * @param length1 number of values in first arithmetic progression * @param first2 first value in second arithmetic progression * @param last2 last value in second arithmetic progression * @param length2 number of values in second arithmetic progression * @param first3 first value in third arithmetic progression * @param last3 last value in third arithmetic progression * @param length3 number of values in third arithmetic progression * @param coord_sys CoordinateSystem for this set. May be null, but * if not, must be consistent withtype. * @param units Unit-s for the values insets. May * be null, but must be convertible with values in *sets. * @param errors ErrorEstimate-s for values insets, * may be null * @throws VisADException problem creating VisAD objects. */ public Linear3DSet(MathType type, double first1, double last1, int length1, double first2, double last2, int length2, double first3, double last3, int length3, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors) throws VisADException { this(type, first1, last1, length1, first2, last2, length2, first3, last3, length3, coord_sys, units, errors, false); } /** * Construct a 3-D cross product of arithmetic progressions with * the specifiedtype,coord_sys, *unitsanderrors. * @param type MathType for this Linear3DSet. * @param first1 first value in first arithmetic progression * @param last1 last value in first arithmetic progression * @param length1 number of values in first arithmetic progression * @param first2 first value in second arithmetic progression * @param last2 last value in second arithmetic progression * @param length2 number of values in second arithmetic progression * @param first3 first value in third arithmetic progression * @param last3 last value in third arithmetic progression * @param length3 number of values in third arithmetic progression * @param coord_sys CoordinateSystem for this set. May be null, but * if not, must be consistent withtype. * @param units Unit-s for the values insets. May * be null, but must be convertible with values in *sets. * @param errors ErrorEstimate-s for values insets, * may be null * @param cache if true, enumerate and cache the samples. This will * result in a larger memory footprint, but will * reduce the time to return samples from calls to * {@link #getSamples()}. * @throws VisADException problem creating VisAD objects. */ public Linear3DSet(MathType type, double first1, double last1, int length1, double first2, double last2, int length2, double first3, double last3, int length3, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors, boolean cache) throws VisADException { this(type, LinearNDSet.get_linear1d_array(type, first1, last1, length1, first2, last2, length2, first3, last3, length3, units), coord_sys, units, errors, cache); } /** * Construct a 3-D cross product ofsets, with * the specifiedtype,coord_sys, *unitsanderrors. * @param type MathType for this Linear3DSet. Must be consistent * with MathType-s ofsets. * @param sets Linear1DSets that make up this Linear3DSet. * @param coord_sys CoordinateSystem for this set. May be null, but * if not, must be consistent withtype. * @param units Unit-s for the values insets. May * be null, but must be convertible with values in *sets. * @param errors ErrorEstimate-s for values insets, * may be null * @throws VisADException illegal sets or other VisAD error. */ public Linear3DSet(MathType type, Linear1DSet[] sets, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors) throws VisADException { this(type, sets, coord_sys, units, errors, false); } /** * Construct a 3-D cross product ofsets, with * the specifiedtype,coord_sys, *unitsanderrors. * @param type MathType for this Linear3DSet. Must be consistent * with MathType-s ofsets. * @param sets Linear1DSets that make up this Linear3DSet. * @param coord_sys CoordinateSystem for this set. May be null, but * if not, must be consistent withtype. * @param units Unit-s for the values insets. May * be null, but must be convertible with values in *sets. * @param errors ErrorEstimate-s for values insets, * may be null * @param cache if true, enumerate and cache the samples. This will * result in a larger memory footprint, but will * reduce the time to return samples from calls to * {@link #getSamples()}. * @throws VisADException illegal sets or other VisAD error. */ public Linear3DSet(MathType type, Linear1DSet[] sets, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors, boolean cache) throws VisADException { super(type, (float[][]) null, sets[0].getLength(), sets[1].getLength(), sets[2].getLength(), coord_sys, LinearNDSet.units_array_linear1d(sets, units), errors); if (DomainDimension != 3) { throw new SetException("Linear3DSet: DomainDimension must be 3, not " + DomainDimension); } if (sets.length != 3) { throw new SetException("Linear3DSet: ManifoldDimension must be 3, not " + sets.length); } Linear1DSet[] ss = LinearNDSet.linear1d_array_units(sets, units); X = ss[0]; Y = ss[1]; Z = ss[2]; LengthX = X.getLength(); LengthY = Y.getLength(); LengthZ = Z.getLength(); Length = LengthX * LengthY * LengthZ; Low[0] = X.getLowX(); Hi[0] = X.getHiX(); Low[1] = Y.getLowX(); Hi[1] = Y.getHiX(); Low[2] = Z.getLowX(); Hi[2] = Z.getHiX(); if (SetErrors[0] != null ) { SetErrors[0] = new ErrorEstimate(SetErrors[0].getErrorValue(), (Low[0] + Hi[0]) / 2.0, Length, SetErrors[0].getUnit()); } if (SetErrors[1] != null ) { SetErrors[1] = new ErrorEstimate(SetErrors[1].getErrorValue(), (Low[1] + Hi[1]) / 2.0, Length, SetErrors[1].getUnit()); } if (SetErrors[2] != null ) { SetErrors[2] = new ErrorEstimate(SetErrors[2].getErrorValue(), (Low[2] + Hi[2]) / 2.0, Length, SetErrors[2].getUnit()); } cacheSamples = cache; } /** * Convert an array of 1-D indices to an array of values in * R^3 space. * @param index array of indices of values in R^3 space. * @return values in R^3 space corresponding to indices. * @throws VisADException problem converting indices to values. */ public float[][] indexToValue(int[] index) throws VisADException { int length = index.length; int[] indexX = new int[length]; int[] indexY = new int[length]; int[] indexZ = new int[length]; float[][] values = new float[3][]; for (int i=0; i1 && (Lengths[0] < 2 || Lengths[1] < 2 || Lengths[2] < 2)) { throw new SetException("Linear3DSet.gridToValue: requires all grid " + "dimensions to be > 1"); } int length = grid[0].length; float[][] gridX = new float[1][]; gridX[0] = grid[0]; float[][] gridY = new float[1][]; gridY[0] = grid[1]; float[][] gridZ = new float[1][]; gridZ[0] = grid[2]; float[][] valueX = X.gridToValue(gridX); float[][] valueY = Y.gridToValue(gridY); float[][] valueZ = Z.gridToValue(gridZ); float[][] value = new float[3][]; value[0] = valueX[0]; value[1] = valueY[0]; value[2] = valueZ[0]; return value; } /** transform an array of values in R^3 to an array of non-integer grid coordinates */ public float[][] valueToGrid(float[][] value) throws VisADException { if (value.length != 3) { throw new SetException("Linear3DSet.valueToGrid: value dimension" + " must be 3, not " + value.length); } if (Length > 1 && (Lengths[0] < 2 || Lengths[1] < 2 || Lengths[2] < 2)) { throw new SetException("Linear3DSet.valueToGrid: requires all grid " + "dimensions to be > 1"); } int length = value[0].length; float[][] valueX = new float[1][]; valueX[0] = value[0]; float[][] valueY = new float[1][]; valueY[0] = value[1]; float[][] valueZ = new float[1][]; valueZ[0] = value[2]; float[][] gridX = X.valueToGrid(valueX); float[][] gridY = Y.valueToGrid(valueY); float[][] gridZ = Z.valueToGrid(valueZ); float[][] grid = new float[3][]; grid[0] = gridX[0]; grid[1] = gridY[0]; grid[2] = gridZ[0]; return grid; } /** * Return the first arithmetic progression for this * cross product (X of XYZ). * @return first arithmetic progression as a Linear1DSet. */ public Linear1DSet getX() { return X; } /** * Return the second arithmetic progression for this * cross product (Y of XYZ). * @return second arithmetic progression as a Linear1DSet. */ public Linear1DSet getY() { return Y; } /** * Return the third arithmetic progression for this * cross product (Z of XYZ). * @return third arithmetic progression as a Linear1DSet. */ public Linear1DSet getZ() { return Z; } /** * Check to see if this is an empty cross-product. * @return always false. */ public boolean isMissing() { return false; } /** * Return the array of values in R^3 space corresponding to * this cross product of arithmetic progressions. * @param copy if true, return a copy of the samples. * @return array of values in R^3 space. * @throws VisADException problem creating samples. */ public float[][] getSamples(boolean copy) throws VisADException { /* DRM 2003-01-16 int n = getLength(); int[] indices = new int[n]; // do NOT call getWedge for (int i=0; i 3) { System.arraycopy(color_temps[3], 0, color_levels[3], 0, nvertex); } // take the garbage out color_temps = null; } if (debug) System.out.println("nvertex= "+nvertex); float[] NxA = new float[npolygons]; float[] NxB = new float[npolygons]; float[] NyA = new float[npolygons]; float[] NyB = new float[npolygons]; float[] NzA = new float[npolygons]; float[] NzB = new float[npolygons]; float[] Pnx = new float[npolygons]; float[] Pny = new float[npolygons]; float[] Pnz = new float[npolygons]; float[] NX = new float[nvertex]; float[] NY = new float[nvertex]; float[] NZ = new float[nvertex]; make_normals( fieldVertices[0], fieldVertices[1], fieldVertices[2], NX, NY, NZ, nvertex, npolygons, Pnx, Pny, Pnz, NxA, NxB, NyA, NyB, NzA, NzB, Pol_f_Vert, Vert_f_Pol); // take the garbage out NxA = NxB = NyA = NyB = NzA = NzB = Pnx = Pny = Pnz = null; float[] normals = new float[3 * nvertex]; int j = 0; for (i=0; i 0) { if (auxLevels == null || auxLevels.length != naux) { throw new SetException("Linear3DSet.isosurf: " +"auxLevels length " + auxLevels.length + " doesn't match expected " + naux); } for (int i=0; i 0) ? new byte[naux][nvertex_estimate] : null; bellow = rear = 0; above = front = 1; /* Initialize the Auxiliar Arrays of Pointers */ /* WLH 25 Oct 97 ix = 9 * (npolygons*2 + 50); iy = 7 * npolygons; ii = ix + iy; */ for (jj=0; jj nvertex_estimate) { // allocate more space nvertex_estimate = 2 * (nvet + 12); if (naux > 0) { for (int i=0; i = 16) { aa++; bb -= 16; } } kk >>= 4; pa += 7; } /* end fill_Vert_f_Pol(ncube); */ /* */ /* find_vertex(); */ /* WLH 2 April 99 vnode0 = ptGRID[pt]; vnode1 = ptGRID[pt + ydim]; vnode2 = ptGRID[pt + 1]; vnode3 = ptGRID[pt + ydim + 1]; vnode4 = ptGRID[pt + xdim_x_ydim]; vnode5 = ptGRID[pt + ydim + xdim_x_ydim]; vnode6 = ptGRID[pt + 1 + xdim_x_ydim]; vnode7 = ptGRID[pt + 1 + ydim + xdim_x_ydim]; */ if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0002) != 0) ) { /* cube vertex 0-1 */ if ( (iz != 0) || (iy != 0) ) { calc_edge[1] = P_array[ bellow*xx + ix*ydim + iy ]; } else { cp = ( ( isovalue - vnode0 ) / ( vnode1 - vnode0 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * samples[0][pt + ydim] + (1.0f-cp) * samples[0][pt]; VY[0][nvet] = (float) cp * samples[1][pt + ydim] + (1.0f-cp) * samples[1][pt]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim] + (1.0f-cp) * samples[2][pt]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim] + (1.0f-cp) * auxValues[j][pt]; */ } calc_edge[1] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0004) != 0) ) { /* cube vertex 0-2 */ if ( (iz != 0) || (ix != 0) ) { calc_edge[2] = P_array[ 2*xx + bellow*yy + iy*xdim + ix ]; } else { cp = ( ( isovalue - vnode0 ) / ( vnode2 - vnode0 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * samples[0][pt + 1] + (1.0f-cp) * samples[0][pt]; VY[0][nvet] = (float) cp * samples[1][pt + 1] + (1.0f-cp) * samples[1][pt]; VZ[0][nvet] = (float) cp * samples[2][pt + 1] + (1.0f-cp) * samples[2][pt]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1] + (1.0f-cp) * auxValues[j][pt]; */ } calc_edge[2] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0008) != 0) ) { /* cube vertex 0-4 */ if ( (ix != 0) || (iy != 0) ) { calc_edge[3] = P_array[ 2*xx + 2*yy + rear*zz + iy ]; } else { cp = ( ( isovalue - vnode0 ) / ( vnode4 - vnode0 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + xdim_x_ydim] + (1.0f-cp) * samples[0][pt]; VY[0][nvet] = (float) cp * samples[1][pt + xdim_x_ydim] + (1.0f-cp) * samples[1][pt]; VZ[0][nvet] = (float) cp * samples[2][pt + xdim_x_ydim] + (1.0f-cp) * samples[2][pt]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt]; */ } calc_edge[3] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0010) != 0) ) { /* cube vertex 1-3 */ if ( (iz != 0) ) { calc_edge[4] = P_array[ 2*xx + bellow*yy + iy*xdim + (ix+1) ]; } else { cp = ( ( isovalue - vnode1 ) / ( vnode3 - vnode1 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + 1] + (1.0f-cp) * samples[0][pt + ydim]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + 1] + (1.0f-cp) * samples[1][pt + ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + 1] + (1.0f-cp) * samples[2][pt + ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + 1] + (1.0f-cp) * auxValues[j][pt + ydim]; */ } calc_edge[4] = nvet; P_array[ 2*xx + bellow*yy + iy*xdim + (ix+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0020) != 0) ) { /* cube vertex 1-5 */ if ( (iy != 0) ) { calc_edge[5] = P_array[ 2*xx + 2*yy + front*zz + iy ]; } else { cp = ( ( isovalue - vnode1 ) / ( vnode5 - vnode1 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim]; */ } calc_edge[5] = nvet; P_array[ 2*xx + 2*yy + front*zz + iy ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0040) != 0) ) { /* cube vertex 2-3 */ if ( (iz != 0) ) { calc_edge[6] = P_array[ bellow*xx + ix*ydim + (iy+1) ]; } else { cp = ( ( isovalue - vnode2 ) / ( vnode3 - vnode2 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + 1] + (1.0f-cp) * samples[0][pt + 1]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + 1] + (1.0f-cp) * samples[1][pt + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + 1] + (1.0f-cp) * samples[2][pt + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + 1] + (1.0f-cp) * auxValues[j][pt + 1]; */ } calc_edge[6] = nvet; P_array[ bellow*xx + ix*ydim + (iy+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0080) != 0) ) { /* cube vertex 2-6 */ if ( (ix != 0) ) { calc_edge[7] = P_array[ 2*xx + 2*yy + rear*zz + (iy+1) ]; } else { cp = ( ( isovalue - vnode2 ) / ( vnode6 - vnode2 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + 1]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + 1]; */ } calc_edge[7] = nvet; P_array[ 2*xx + 2*yy + rear*zz + (iy+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0100) != 0) ) { /* cube vertex 3-7 */ cp = ( ( isovalue - vnode3 ) / ( vnode7 - vnode3 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim + 1]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim + 1]; */ } calc_edge[8] = nvet; P_array[ 2*xx + 2*yy + front*zz + (iy+1) ] = nvet; nvet++; } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0200) != 0) ) { /* cube vertex 4-5 */ if ( (iy != 0) ) { calc_edge[9] = P_array[ above*xx + ix*ydim + iy ]; } else { cp = ( ( isovalue - vnode4 ) / ( vnode5 - vnode4 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + xdim_x_ydim]; */ } calc_edge[9] = nvet; P_array[ above*xx + ix*ydim + iy ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0400) != 0) ) { /* cube vertex 4-6 */ if ( (ix != 0) ) { calc_edge[10] = P_array[ 2*xx + above*yy + iy*xdim + ix ]; } else { cp = ( ( isovalue - vnode4 ) / ( vnode6 - vnode4 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + xdim_x_ydim]; */ } calc_edge[10] = nvet; P_array[ 2*xx + above*yy + iy*xdim + ix ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0800) != 0) ) { /* cube vertex 5-7 */ cp = ( ( isovalue - vnode5 ) / ( vnode7 - vnode5 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim + xdim_x_ydim]; */ } calc_edge[11] = nvet; P_array[ 2*xx + above*yy + iy*xdim + (ix+1) ] = nvet; nvet++; } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x1000) != 0) ) { /* cube vertex 6-7 */ cp = ( ( isovalue - vnode6 ) / ( vnode7 - vnode6 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + 1 + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + 1 + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + 1 + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + 1 + xdim_x_ydim]; */ } calc_edge[12] = nvet; P_array[ above*xx + ix*ydim + (iy+1) ] = nvet; nvet++; } /* end find_vertex(); */ /* update_data_structure(ncube); */ kk = pol_edges[ptFLAG[ncube]][2]; nn = pol_edges[ptFLAG[ncube]][1]; for (ii=0; ii >= 4; pvp += 7; cpl++; } /* end update_data_structure(ncube); */ } else { // !(ptFLAG[ncube] < MAX_FLAG_NUM) /* find_vertex_invalid_cube(ncube); */ ptFLAG[ncube] &= 0x1FF; if ( (ptFLAG[ncube] != 0 & ptFLAG[ncube] != 0xFF) ) { if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0010) != 0) ) /* cube vertex 1-3 */ /* WLH 24 Oct 97 { if (!(iz != 0 ) && vnode3 < INV_VAL && vnode1 < INV_VAL) { if (!(iz != 0 ) && !Float.isNaN(vnode3) && !Float.isNaN(vnode1)) */ // test for not missing { if (!(iz != 0 ) && vnode3 == vnode3 && vnode1 == vnode1) { cp = ( ( isovalue - vnode1 ) / ( vnode3 - vnode1 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * mySamples[0][pt + ydim + 1] + (1.0f-cp) * mySamples[0][pt + ydim]; VY[0][nvet] = (float) cp * mySamples[1][pt + ydim + 1] + (1.0f-cp) * mySamples[1][pt + ydim]; VZ[0][nvet] = (float) cp * mySamples[2][pt + ydim + 1] + (1.0f-cp) * mySamples[2][pt + ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + 1] + (1.0f-cp) * auxValues[j][pt + ydim]; */ } P_array[ 2*xx + bellow*yy + iy*xdim + (ix+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0020) != 0) ) /* cube vertex 1-5 */ /* WLH 24 Oct 97 { if (!(iy != 0) && vnode5 < INV_VAL && vnode1 < INV_VAL) { if (!(iy != 0) && !Float.isNaN(vnode5) && !Float.isNaN(vnode1)) */ // test for not missing { if (!(iy != 0) && vnode5 == vnode5 && vnode1 == vnode1) { cp = ( ( isovalue - vnode1 ) / ( vnode5 - vnode1 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim]; */ } P_array[ 2*xx + 2*yy + front*zz + iy ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0040) != 0) ) /* cube vertex 2-3 */ /* WLH 24 Oct 97 { if (!(iz != 0) && vnode3 < INV_VAL && vnode2 < INV_VAL) { if (!(iz != 0) && !Float.isNaN(vnode3) && !Float.isNaN(vnode2)) */ // test for not missing { if (!(iz != 0) && vnode3 == vnode3 && vnode2 == vnode2) { cp = ( ( isovalue - vnode2 ) / ( vnode3 - vnode2 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * iz; /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + 1] + (1.0f-cp) * samples[0][pt + 1]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + 1] + (1.0f-cp) * samples[1][pt + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + 1] + (1.0f-cp) * samples[2][pt + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + 1] + (1.0f-cp) * auxValues[j][pt + 1]; */ } P_array[ bellow*xx + ix*ydim + (iy+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0080) != 0) ) /* cube vertex 2-6 */ /* WLH 24 Oct 97 { if (!(ix != 0) && vnode6 < INV_VAL && vnode2 < INV_VAL) { if (!(ix != 0) && !Float.isNaN(vnode6) && !Float.isNaN(vnode2)) */ // test for not missing { if (!(ix != 0) && vnode6 == vnode6 && vnode2 == vnode2) { cp = ( ( isovalue - vnode2 ) / ( vnode6 - vnode2 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + 1]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + 1]; */ } P_array[ 2*xx + 2*yy + rear*zz + (iy+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0100) != 0) ) /* cube vertex 3-7 */ /* WLH 24 Oct 97 { if (vnode7 < INV_VAL && vnode3 < INV_VAL) { if (!Float.isNaN(vnode7) && !Float.isNaN(vnode3)) */ // test for not missing { if (vnode7 == vnode7 && vnode3 == vnode3) { cp = ( ( isovalue - vnode3 ) / ( vnode7 - vnode3 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (cp + iz); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim + 1]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim + 1]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim + 1]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim + 1]; */ } P_array[ 2*xx + 2*yy + front*zz + (iy+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0200) != 0) ) /* cube vertex 4-5 */ /* WLH 24 Oct 97 { if (!(iy != 0) && vnode5 < INV_VAL && vnode4 < INV_VAL) { if (!(iy != 0) && !Float.isNaN(vnode5) && !Float.isNaN(vnode4)) */ // test for not missing { if (!(iy != 0) && vnode5 == vnode5 && vnode4 == vnode4) { cp = ( ( isovalue - vnode4 ) / ( vnode5 - vnode4 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * iy; VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + xdim_x_ydim]; */ } P_array[ above*xx + ix*ydim + iy ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0400) != 0) ) /* cube vertex 4-6 */ /* WLH 24 Oct 97 { if (!(ix != 0) && vnode6 < INV_VAL && vnode4 < INV_VAL) { if (!(ix != 0) && !Float.isNaN(vnode6) && !Float.isNaN(vnode4)) */ // test for not missing { if (!(ix != 0) && vnode6 == vnode6 && vnode4 == vnode4) { cp = ( ( isovalue - vnode4 ) / ( vnode6 - vnode4 ) ); VX[0][nvet] = xo + xs * ix; VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + xdim_x_ydim]; */ } P_array[ 2*xx + above*yy + iy*xdim + ix ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x0800) != 0) ) /* cube vertex 5-7 */ /* WLH 24 Oct 97 { if (vnode7 < INV_VAL && vnode5 < INV_VAL) { if (!Float.isNaN(vnode7) && !Float.isNaN(vnode5)) */ // test for not missing { if (vnode7 == vnode7 && vnode5 == vnode5) { cp = ( ( isovalue - vnode5 ) / ( vnode7 - vnode5 ) ); VX[0][nvet] = xo + xs * (ix+1); VY[0][nvet] = yo + ys * (cp + iy); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + ydim + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + ydim + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + ydim + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + ydim + xdim_x_ydim]; */ } P_array[ 2*xx + above*yy + iy*xdim + (ix+1) ] = nvet; nvet++; } } if ( ((pol_edges[ptFLAG[ncube]][3] & 0x1000) != 0) ) /* cube vertex 6-7 */ /* WLH 24 Oct 97 { if (vnode7 < INV_VAL && vnode6 < INV_VAL) { if (!Float.isNaN(vnode7) && !Float.isNaN(vnode6)) */ // test for not missing { if (vnode7 == vnode7 && vnode6 == vnode6) { cp = ( ( isovalue - vnode6 ) / ( vnode7 - vnode6 ) ); VX[0][nvet] = xo + xs * (cp + ix); VY[0][nvet] = yo + ys * (iy+1); VZ[0][nvet] = zo + zs * (iz+1); /* VX[0][nvet] = (float) cp * samples[0][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[0][pt + 1 + xdim_x_ydim]; VY[0][nvet] = (float) cp * samples[1][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[1][pt + 1 + xdim_x_ydim]; VZ[0][nvet] = (float) cp * samples[2][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * samples[2][pt + 1 + xdim_x_ydim]; */ for (int j=0; j 255) ? -1 : ((t < 128) ? t : t - 256) ) ); /* MEM_WLH tempaux[j][nvet] = (float) cp * auxValues[j][pt + 1 + ydim + xdim_x_ydim] + (1.0f-cp) * auxValues[j][pt + 1 + xdim_x_ydim]; */ } P_array[ above*xx + ix*ydim + (iy+1) ] = nvet; nvet++; } } } /* end find_vertex_invalid_cube(ncube); */ } } /* end if (exist_polygon_in_cube(ncube)) */ ncube++; pt++; } /* end for ( iy = 0; iy < ydim - 1; iy++ ) */ /* swap_planes(Z,rear,front); */ caseA = rear; rear = front; front = caseA; pt++; /* end swap_planes(Z,rear,front); */ } /* end for ( ix = 0; ix < xdim - 1; ix++ ) */ /* swap_planes(XY,bellow,above); */ caseA = bellow; bellow = above; above = caseA; pt += ydim; /* end swap_planes(XY,bellow,above); */ } /* end for ( iz = 0; iz < zdim - 1; iz++ ) */ // copy tempaux array into auxLevels array for (int i=0; i set type. * @throws VisADException iftypeis not compatible * with MathType of component Linear1DSets. */ public Object cloneButType(MathType type) throws VisADException { Linear1DSet[] sets = {(Linear1DSet) X.clone(), (Linear1DSet) Y.clone(), (Linear1DSet) Z.clone()}; return new Linear3DSet(type, sets, DomainCoordinateSystem, SetUnits, SetErrors, cacheSamples); } /** * Extended version of the toString() method. * @param pre prefix for string. * @return wordy string describing this Linear3DSet. */ public String longString(String pre) throws VisADException { String s = pre + "Linear3DSet: Length = " + Length + "\n"; s = s + pre + " Dimension 1: Length = " + X.getLength() + " Range = " + X.getFirst() + " to " + X.getLast() + "\n"; s = s + pre + " Dimension 2: Length = " + Y.getLength() + " Range = " + Y.getFirst() + " to " + Y.getLast() + "\n"; s = s + pre + " Dimension 3: Length = " + Z.getLength() + " Range = " + Z.getFirst() + " to " + Z.getLast() + "\n"; return s; } }
Ads help maintain this website.