static int inCircleRobust(Point2D p, Point2D q, Point2D r, Point2D s) {
		ECoordinate psx_ec = new ECoordinate(), psy_ec = new ECoordinate();
		psx_ec.set(p.x);
		psx_ec.sub(s.x);
		psy_ec.set(p.y);
		psy_ec.sub(s.y);

		ECoordinate qsx_ec = new ECoordinate(), qsy_ec = new ECoordinate();
		qsx_ec.set(q.x);
		qsx_ec.sub(s.x);
		qsy_ec.set(q.y);
		qsy_ec.sub(s.y);

		ECoordinate rsx_ec = new ECoordinate(), rsy_ec = new ECoordinate();
		rsx_ec.set(r.x);
		rsx_ec.sub(s.x);
		rsy_ec.set(r.y);
		rsy_ec.sub(s.y);

		ECoordinate psx_ec_qsy_ec = new ECoordinate();
		psx_ec_qsy_ec.set(psx_ec);
		psx_ec_qsy_ec.mul(qsy_ec);
		ECoordinate psy_ec_qsx_ec = new ECoordinate();
		psy_ec_qsx_ec.set(psy_ec);
		psy_ec_qsx_ec.mul(qsx_ec);
		ECoordinate qsx_ec_rsy_ec = new ECoordinate();
		qsx_ec_rsy_ec.set(qsx_ec);
		qsx_ec_rsy_ec.mul(rsy_ec);
		ECoordinate qsy_ec_rsx_ec = new ECoordinate();
		qsy_ec_rsx_ec.set(qsy_ec);
		qsy_ec_rsx_ec.mul(rsx_ec);
		ECoordinate psx_ec_rsy_ec = new ECoordinate();
		psx_ec_rsy_ec.set(psx_ec);
		psx_ec_rsy_ec.mul(rsy_ec);
		ECoordinate psy_ec_rsx_ec = new ECoordinate();
		psy_ec_rsx_ec.set(psy_ec);
		psy_ec_rsx_ec.mul(rsx_ec);

		ECoordinate pq_det_ec = new ECoordinate();
		pq_det_ec.set(psx_ec_qsy_ec);
		pq_det_ec.sub(psy_ec_qsx_ec);
		ECoordinate qr_det_ec = new ECoordinate();
		qr_det_ec.set(qsx_ec_rsy_ec);
		qr_det_ec.sub(qsy_ec_rsx_ec);
		ECoordinate pr_det_ec = new ECoordinate();
		pr_det_ec.set(psx_ec_rsy_ec);
		pr_det_ec.sub(psy_ec_rsx_ec);

		ECoordinate psx_ec_psx_ec = new ECoordinate();
		psx_ec_psx_ec.set(psx_ec);
		psx_ec_psx_ec.mul(psx_ec);
		ECoordinate psy_ec_psy_ec = new ECoordinate();
		psy_ec_psy_ec.set(psy_ec);
		psy_ec_psy_ec.mul(psy_ec);
		ECoordinate qsx_ec_qsx_ec = new ECoordinate();
		qsx_ec_qsx_ec.set(qsx_ec);
		qsx_ec_qsx_ec.mul(qsx_ec);
		ECoordinate qsy_ec_qsy_ec = new ECoordinate();
		qsy_ec_qsy_ec.set(qsy_ec);
		qsy_ec_qsy_ec.mul(qsy_ec);
		ECoordinate rsx_ec_rsx_ec = new ECoordinate();
		rsx_ec_rsx_ec.set(rsx_ec);
		rsx_ec_rsx_ec.mul(rsx_ec);
		ECoordinate rsy_ec_rsy_ec = new ECoordinate();
		rsy_ec_rsy_ec.set(rsy_ec);
		rsy_ec_rsy_ec.mul(rsy_ec);

		ECoordinate p_parab_ec = new ECoordinate();
		p_parab_ec.set(psx_ec_psx_ec);
		p_parab_ec.add(psy_ec_psy_ec);
		ECoordinate q_parab_ec = new ECoordinate();
		q_parab_ec.set(qsx_ec_qsx_ec);
		q_parab_ec.add(qsy_ec_qsy_ec);
		ECoordinate r_parab_ec = new ECoordinate();
		r_parab_ec.set(rsx_ec_rsx_ec);
		r_parab_ec.add(rsy_ec_rsy_ec);

		p_parab_ec.mul(qr_det_ec);
		q_parab_ec.mul(pr_det_ec);
		r_parab_ec.mul(pq_det_ec);

		ECoordinate det_ec = new ECoordinate();
		det_ec.set(p_parab_ec);
		det_ec.sub(q_parab_ec);
		det_ec.add(r_parab_ec);

		if (!det_ec.isFuzzyZero()) {
			double det_ec_value = det_ec.value();

			if (det_ec_value < 0.0)
				return -1;

			if (det_ec_value > 0.0)
				return 1;

			return 0;
		}

		return inCircleRobustMP_(p, q, r, s);
	}
static int inCircleRobust ( Point2D p , Point2D q , Point2D r , Point2D s ) { ECoordinate psx_ec = new ECoordinate ( ) , psy_ec = new ECoordinate ( ) ; psx_ec . set ( p . x ) ; psx_ec . sub ( s . x ) ; psy_ec . set ( p . y ) ; psy_ec . sub ( s . y ) ; ECoordinate qsx_ec = new ECoordinate ( ) , qsy_ec = new ECoordinate ( ) ; qsx_ec . set ( q . x ) ; qsx_ec . sub ( s . x ) ; qsy_ec . set ( q . y ) ; qsy_ec . sub ( s . y ) ; ECoordinate rsx_ec = new ECoordinate ( ) , rsy_ec = new ECoordinate ( ) ; rsx_ec . set ( r . x ) ; rsx_ec . sub ( s . x ) ; rsy_ec . set ( r . y ) ; rsy_ec . sub ( s . y ) ; ECoordinate psx_ec_qsy_ec = new ECoordinate ( ) ; psx_ec_qsy_ec . set ( psx_ec ) ; psx_ec_qsy_ec . mul ( qsy_ec ) ; ECoordinate psy_ec_qsx_ec = new ECoordinate ( ) ; psy_ec_qsx_ec . set ( psy_ec ) ; psy_ec_qsx_ec . mul ( qsx_ec ) ; ECoordinate qsx_ec_rsy_ec = new ECoordinate ( ) ; qsx_ec_rsy_ec . set ( qsx_ec ) ; qsx_ec_rsy_ec . mul ( rsy_ec ) ; ECoordinate qsy_ec_rsx_ec = new ECoordinate ( ) ; qsy_ec_rsx_ec . set ( qsy_ec ) ; qsy_ec_rsx_ec . mul ( rsx_ec ) ; ECoordinate psx_ec_rsy_ec = new ECoordinate ( ) ; psx_ec_rsy_ec . set ( psx_ec ) ; psx_ec_rsy_ec . mul ( rsy_ec ) ; ECoordinate psy_ec_rsx_ec = new ECoordinate ( ) ; psy_ec_rsx_ec . set ( psy_ec ) ; psy_ec_rsx_ec . mul ( rsx_ec ) ; ECoordinate pq_det_ec = new ECoordinate ( ) ; pq_det_ec . set ( psx_ec_qsy_ec ) ; pq_det_ec . sub ( psy_ec_qsx_ec ) ; ECoordinate qr_det_ec = new ECoordinate ( ) ; qr_det_ec . set ( qsx_ec_rsy_ec ) ; qr_det_ec . sub ( qsy_ec_rsx_ec ) ; ECoordinate pr_det_ec = new ECoordinate ( ) ; pr_det_ec . set ( psx_ec_rsy_ec ) ; pr_det_ec . sub ( psy_ec_rsx_ec ) ; ECoordinate psx_ec_psx_ec = new ECoordinate ( ) ; psx_ec_psx_ec . set ( psx_ec ) ; psx_ec_psx_ec . mul ( psx_ec ) ; ECoordinate psy_ec_psy_ec = new ECoordinate ( ) ; psy_ec_psy_ec . set ( psy_ec ) ; psy_ec_psy_ec . mul ( psy_ec ) ; ECoordinate qsx_ec_qsx_ec = new ECoordinate ( ) ; qsx_ec_qsx_ec . set ( qsx_ec ) ; qsx_ec_qsx_ec . mul ( qsx_ec ) ; ECoordinate qsy_ec_qsy_ec = new ECoordinate ( ) ; qsy_ec_qsy_ec . set ( qsy_ec ) ; qsy_ec_qsy_ec . mul ( qsy_ec ) ; ECoordinate rsx_ec_rsx_ec = new ECoordinate ( ) ; rsx_ec_rsx_ec . set ( rsx_ec ) ; rsx_ec_rsx_ec . mul ( rsx_ec ) ; ECoordinate rsy_ec_rsy_ec = new ECoordinate ( ) ; rsy_ec_rsy_ec . set ( rsy_ec ) ; rsy_ec_rsy_ec . mul ( rsy_ec ) ; ECoordinate p_parab_ec = new ECoordinate ( ) ; p_parab_ec . set ( psx_ec_psx_ec ) ; p_parab_ec . add ( psy_ec_psy_ec ) ; ECoordinate q_parab_ec = new ECoordinate ( ) ; q_parab_ec . set ( qsx_ec_qsx_ec ) ; q_parab_ec . add ( qsy_ec_qsy_ec ) ; ECoordinate r_parab_ec = new ECoordinate ( ) ; r_parab_ec . set ( rsx_ec_rsx_ec ) ; r_parab_ec . add ( rsy_ec_rsy_ec ) ; p_parab_ec . mul ( qr_det_ec ) ; q_parab_ec . mul ( pr_det_ec ) ; r_parab_ec . mul ( pq_det_ec ) ; ECoordinate det_ec = new ECoordinate ( ) ; det_ec . set ( p_parab_ec ) ; det_ec . sub ( q_parab_ec ) ; det_ec . add ( r_parab_ec ) ; if ( ! det_ec . isFuzzyZero ( ) ) { double det_ec_value = det_ec . value ( ) ; if ( det_ec_value < 0.0 ) return - 1 ; if ( det_ec_value > 0.0 ) return 1 ; return 0 ; } return inCircleRobustMP_ ( p , q , r , s ) ; }
Calculates if the point s is inside of the circumcircle inscribed by the clockwise oriented triangle p-q-r.
Returns 1 for outside, -1 for inside, and 0 for cocircular.
Note that the convention used here differs from what is commonly found in literature, which can define the relation
in terms of a counter-clockwise oriented circle, and this flips the sign (think of the signed volume of the tetrahedron).
May use high precision arithmetics for some special cases.