Codota Logo
TriMesh$Node.x
Code IndexAdd Codota to your IDE (free)

How to use
x
method
in
edu.mines.jtk.mesh.TriMesh$Node

Best Java code snippets using edu.mines.jtk.mesh.TriMesh$Node.x (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: dhale/jtk

float xn,yn;
if (_orientation==Orientation.XRIGHT_YUP) {
 xn = node.x();
 yn = node.y();
} else {
 xn = node.y();
 yn = node.x();
origin: dhale/jtk

for (int ifind=0; ifind<nfind; ++ifind) {
 if (nfast[ifind]!=nslow[ifind]) {
  float xfast = nfast[ifind].x();
  float yfast = nfast[ifind].y();
  float xslow = nslow[ifind].x();
  float yslow = nslow[ifind].y();
  float dxfast = xfast-x[ifind];
origin: dhale/jtk

private float x(TriMesh.Node node) {
 if (_orientation==Orientation.XRIGHT_YUP) {
  return node.x();
 } else {
  return node.y();
 }
}
origin: dhale/jtk

private float y(TriMesh.Node node) {
 if (_orientation==Orientation.XRIGHT_YUP) {
  return node.y();
 } else {
  return node.x();
 }
}
origin: dhale/jtk

@Override
public String toString() {
 return "("+x()+","+y()+")";
}
origin: dhale/jtk

/**
 * Called when bounds on (x,y) coordinates in mesh may have changed.
 */
private void updateMinMax() {
 if (_mesh==null)
  return;
 _xmin = Float.MAX_VALUE;
 _ymin = Float.MAX_VALUE;
 _xmax = -Float.MAX_VALUE;
 _ymax = -Float.MAX_VALUE;
 TriMesh.NodeIterator ni = _mesh.getNodes();
 while (ni.hasNext()) {
  TriMesh.Node node = ni.next();
  float x = node.x();
  float y = node.y();
  if (x<_xmin) _xmin = x;
  if (y<_ymin) _ymin = y;
  if (x>_xmax) _xmax = x;
  if (y>_ymax) _ymax = y;
 }
}
origin: dhale/jtk

/**
 * Moves a node in the mesh to the specified (x,y) coordinates.
 * Roughly equivalent to (but potentially more efficient than)
 * first removing and then adding the node to the mesh at the 
 * specified coordinates. However, if the node is not in the mesh, 
 * then it will be moved, but not added to the mesh. Also, if the 
 * specified coordinates are already occupied by another node in 
 * the mesh, then the specified node is not moved.
 * @param node a node in the mesh.
 * @param x the x coordinate of the moved node.
 * @param y the y coordinate of the moved node.
 * @return true, if the node was moved; false, otherwise.
 */
public synchronized boolean moveNode(Node node, float x, float y) {
 // TODO: optimize for small movements that require no retriangulation.
 if (x!=node.x() || y!=node.y()) {
  Node nodeNearest = findNodeNearest(x,y);
  if (node==nodeNearest || x!=nodeNearest.x() || y!=nodeNearest.y()) {
   boolean nodeInMesh = removeNode(node);
   node.setPosition(x,y);
   if (nodeInMesh) {
    boolean addedNode = addNode(node);
    assert addedNode;
   }
   return true;
  }
 }
 return false;
}
origin: dhale/jtk

/**
 * Interpolates at specified sample points without using those samples.
 * This method implements a form of cross-validation. Differences
 * between the values of the specified samples and the returned 
 * interpolated values are measures of errors for those samples.
 * <p>
 * If bounds have not been set explicitly, then this method will return 
 * null values if the validated sample is on the convex hull of samples.
 * <p>
 * This method does not recompute gradients that may have been estimated 
 * using the samples to be validated. Therefore, validation should be 
 * performed without using gradients. 
 * @param i array of indices of samples to validate.
 * @return array of values interpolated at validated sample points.
 */
public float[] validate(int[] i) {
 int nv = i.length;
 for (int iv=0; iv<nv; ++iv)
  _mesh.removeNode(_nodes[i[iv]]);
 float[] fv = new float[nv];
 for (int iv=0; iv<nv; ++iv) {
  TriMesh.Node node = _nodes[i[iv]];
  float xn = node.x();
  float yn = node.y();
  fv[iv] = interpolate(xn,yn);
 }
 for (int iv=0; iv<nv; ++iv)
  _mesh.addNode(_nodes[i[iv]]);
 return fv;
}
origin: dhale/jtk

/**
 * Computes nearest neighbor distances and values.
 * @param s1 sampling for coordinate x1.
 * @param s2 sampling for coordinate x2.
 * @param d array of distances to nearest known samples.
 * @param g array of nearest known sample values.
 */
public void computeDistancesAndValues(
 Sampling s1, Sampling s2, float[][] d, float[][] g) 
{
 int n1 = s1.getCount();
 int n2 = s2.getCount();
 for (int i2=0; i2<n2; ++i2) {
  float x2 = (float)s2.getValue(i2);
  for (int i1=0; i1<n1; ++i1) {
   float x1 = (float)s1.getValue(i1);
   TriMesh.Node node = _mesh.findNodeNearest(x1,x2);
   float d1 = x1-node.x();
   float d2 = x2-node.y();
   if (g!=null)
    g[i2][i1] = _f[node.index];
   if (d!=null) 
    d[i2][i1] = sqrt(d1*d1+d2*d2);
  }
 }
}
origin: dhale/jtk

/**
 * Locates a point.
 */
private PointLocation locatePoint(double x, double y) {
 // If no tris yet, search the node list for an exact match.
 // Here, we use unperturbed node coordinates.
 if (_troot==null) {
  if (_nroot!=null) {
   Node node = _nroot;
   do {
    if (x==node.x() && y==node.y())
     return new PointLocation(node);
    node = node._next;
   } while (node!=_nroot);
  }
  return new PointLocation(null,false);
 }
 // Otherwise, find a good tri in which to begin the recursive search.
 Node nmin = _nroot;
 double dmin = distanceSquared(nmin,x,y);
 for (Node n:_sampledNodes) {
  double d = distanceSquared(n,x,y);
  if (d<dmin) {
   dmin = d;
   nmin = n;
  }
 }
 Tri tri = nmin._tri;
 return locatePoint(tri,x,y);
}
edu.mines.jtk.meshTriMesh$Nodex

Javadoc

Returns the x coordinate of this node.

Popular methods of TriMesh$Node

  • <init>
    Constructs a node with the specified coordinates. (Does not add the node to the mesh.)
  • y
    Returns the y coordinate of this node.
  • perturb
    Perturbs a float into a double with pseudo-random least-significant bits. Perturbation helps prevent
  • setPosition
    Sets the position of a node that is not in the mesh.
  • tri
    Returns a tri that references this node.
  • xp
    Returns the x coordinate of this node as a perturbed double.
  • yp
    Returns the y coordinate of this node as a perturbed double.

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
  • onRequestPermissionsResult (Fragment)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • ImageIO (javax.imageio)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now