How to use robust-orientation - 6 common examples

To help you get started, we’ve selected a few robust-orientation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Louis-T / fernandez-polygon-decomposition / src / utils.js View on Github external
export function orientation (point1, point2, point3) {
  if (robust) {
    const o = robustOrientation([point1.x, point1.y], [point2.x, point2.y], [point3.x, point3.y]);
    return o === 0 ? o : -o; // the y-axis is inverted
  } else {
    // return -((point1.y - point3.y) * (point2.x - point3.x) - (point1.x - point3.x) * (point2.y - point3.y));
    return (point2.x - point1.x) * (point3.y - point1.y) - (point2.y - point1.y) * (point3.x - point1.x);
  }
}
github mikolalysenko / weighted-delaunay / index.html View on Github external
function incrementalConvexHull(points, randomSearch) {
  var n = points.length
  if(n === 0) {
    throw new Error("Must have at least d+1 points")
  }
  var d = points[0].length
  if(n <= d) {
    throw new Error("Must input at least d+1 points")
  }

  //FIXME: This could be degenerate, but need to select d+1 non-coplanar points to bootstrap process
  var initialSimplex = points.slice(0, d+1)

  //Make sure initial simplex is positively oriented
  var o = orient.apply(void 0, initialSimplex)
  if(o === 0) {
    throw new Error("Input not in general position")
  }
  var initialCoords = new Array(d+1)
  for(var i=0; i<=d; ++i) {
    initialCoords[i] = i
  }
  if(o < 0) {
    initialCoords[0] = 1
    initialCoords[1] = 0
  }

  //Create initial topological index, glue pointers together (kind of messy)
  var initialCell = new Simplex(initialCoords, new Array(d+1), false)
  var boundary = initialCell.adjacent
  var list = new Array(d+2)
github mikolalysenko / weighted-delaunay / index.html View on Github external
function linearlyIndependent(points, d) {
  var nhull = new Array(d+1)
  for(var i=0; i
github mikolalysenko / incremental-delaunay / delaunay.js View on Github external
proto.degenerate = function() {
  var pointList = new Array(this.vertices.length)
  for(var i=0; i
github catmaid / CATMAID / django / applications / catmaid / static / libs / geometry / geometry.js View on Github external
function incrementalConvexHull(points, randomSearch) {
  var n = points.length
  if(n === 0) {
    throw new Error("Must have at least d+1 points")
  }
  var d = points[0].length
  if(n <= d) {
    throw new Error("Must input at least d+1 points")
  }

  //FIXME: This could be degenerate, but need to select d+1 non-coplanar points to bootstrap process
  var initialSimplex = points.slice(0, d+1)

  //Make sure initial simplex is positively oriented
  var o = orient.apply(void 0, initialSimplex)
  if(o === 0) {
    throw new Error("Input not in general position")
  }
  var initialCoords = new Array(d+1)
  for(var i=0; i<=d; ++i) {
    initialCoords[i] = i
  }
  if(o < 0) {
    initialCoords[0] = 1
    initialCoords[1] = 0
  }

  //Create initial topological index, glue pointers together (kind of messy)
  var initialCell = new Simplex(initialCoords, new Array(d+1), false)
  var boundary = initialCell.adjacent
  var list = new Array(d+2)
github catmaid / CATMAID / django / applications / catmaid / static / libs / geometry / geometry.js View on Github external
function linearlyIndependent(points, d) {
  var nhull = new Array(d+1)
  for(var i=0; i

robust-orientation

Exactly computes the orientation of a tuple of points

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis

Popular robust-orientation functions