Migrate mjtByte to mjtBool for boolean-valued fields.
PiperOrigin-RevId: 921408093 Change-Id: Icb00457836359779f0f72fc02d6a7c0dc9f6bd23
This commit is contained in:
committed by
Copybara-Service
parent
3cabb2eb8e
commit
393c1e4217
@@ -33,21 +33,21 @@
|
||||
//------------------------------ tendon wrapping ---------------------------------------------------
|
||||
|
||||
// check for intersection of two 2D line segments
|
||||
static mjtByte is_intersect(const mjtNum* p1, const mjtNum* p2,
|
||||
static mjtBool is_intersect(const mjtNum* p1, const mjtNum* p2,
|
||||
const mjtNum* p3, const mjtNum* p4) {
|
||||
mjtNum a, b;
|
||||
|
||||
// compute determinant, check
|
||||
mjtNum det = (p4[1]-p3[1])*(p2[0]-p1[0]) - (p4[0]-p3[0])*(p2[1]-p1[1]);
|
||||
if (mju_abs(det) < mjMINVAL) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// compute intersection point on each line
|
||||
a = ((p4[0]-p3[0])*(p1[1]-p3[1]) - (p4[1]-p3[1])*(p1[0]-p3[0])) / det;
|
||||
b = ((p2[0]-p1[0])*(p1[1]-p3[1]) - (p2[1]-p1[1])*(p1[0]-p3[0])) / det;
|
||||
|
||||
return ((a >= 0 && a <= 1 && b >= 0 && b <= 1) ? 1 : 0);
|
||||
return ((a >= 0 && a <= 1 && b >= 0 && b <= 1) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user