Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to 0.16.3 #100

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ ODE16.2: Much better. Floating card is actually fine (in theory). But3rd row col
// TODO TZ fix
// TODO CHECK-TZ

- Fix DLCP.ROWPTRS = true?!? -> DEFAULT in 0.16.3
- Fix


0.5.0 (unreleased)
=====
- Port updates until 0.16.3. [#98](https://github.com/tzaeschke/ode4j/pull/98)
- Port updates until 0.16.2.
This includes some libCCD updates missing fro the 0.15.1 update.
This excludes improved solution finders with anything from *Cooperative* and ThreadedEquationSolverLDLT*.
Expand Down
Binary file removed DemoCardsProblem-ODE16.2.odt
Binary file not shown.
1 change: 1 addition & 0 deletions J_Defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ _MSC_VER
dSINGLE


./bootstrap
./configure --enable-double-precision --with-trimesh=gimpact --enable-libccd
60 changes: 24 additions & 36 deletions core/src/main/java/org/ode4j/ode/internal/DLCP.java
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,14 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) {
// dReal *_lo, dReal *_hi, dReal *_L, dReal *_d,
// dReal *_Dell, dReal *_ell, dReal *_tmp,
// int *_state, int *_findex, int *_p, int *_C, dReal **Arows)
DLCP (int _n, int _nskip, int _nub, double []_Adata, double[] _pairsbxA, double[] _w,
DLCP (int n, int nskip, int nub, double []_Adata, double[] _pairsbxA, double[] _w,
double[] m_pairslh, double[] _L, double[] _d,
double[] _Dell, double[] _ell, double[] _tmp,
boolean []_state, int []_findex, int []_p, int []_C, double[][] Arows)
boolean []_state, int []findex, int []p, int []_C, double[][] Arows)
{
m_n = _n;
m_nskip = _nskip;
m_nub = _nub;
m_n = n;
m_nskip = nskip;
m_nub = nub;
if (ROWPTRS) {//# ifdef ROWPTRS
//m_A(Arows),
throw new UnsupportedOperationException();
Expand All @@ -607,8 +607,8 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) {
m_ell = _ell;
m_tmp = _tmp;
m_state = _state;
m_findex = _findex;
m_p = _p;
m_findex = findex;
m_p = p;
m_C = _C;

//dxtSetZero<PBX__MAX>(m_pairsbx + PBX_X, m_n);
Expand All @@ -618,22 +618,17 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) {
// make matrix row pointers
// dReal *aptr = _Adata;
// ATYPE A = m_A;
// const int n = m_n, nskip = m_nskip;
// for (int k=0; k<n; aptr+=nskip, ++k) A[k] = aptr;
throw new UnsupportedOperationException();
}//# endif

{
int []p = m_p;
final int n = m_n;
for (int k=0; k!=n; ++k) p[k]=k; // initially unpermuted
}

/*
// for testing, we can do some random swaps in the area i > nub
{
const int n = m_n;
const int nub = m_nub;
if (nub < n) {
for (int k=0; k<100; k++) {
int i1,i2;
Expand All @@ -657,52 +652,47 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) {
// if lo=-inf and hi=inf - this is because these limits may change during the
// solution process.

int currNub = nub;
{
int[] findex = m_findex;
double[] pairslhA = m_pairslh;
int pairslhP = 0;
final int n = m_n;
for (int k = m_nub; k<n; ++k) {
for (int k = currNub; k<n; ++k) {
if (findex!=null && findex[k] >= 0) continue;
if (pairslhA[pairslhP + k * PLH__MAX + PLH_LO] == -dInfinity && pairslhA[pairslhP + k * PLH__MAX + PLH_HI] == dInfinity) {
swapProblem(m_A, m_pairsbxA, 0, m_w, pairslhA, pairslhP, m_p, m_state, findex, n, m_nub, k, m_nskip, false);
m_nub++;
swapProblem(m_A, m_pairsbxA, 0, m_w, pairslhA, pairslhP, m_p, m_state, findex, n, currNub, k, nskip, false);
m_nub = ++currNub;
}
}
}

// if there are unbounded variables at the start, factorize A up to that
// point and solve for x. this puts all indexes 0..nub-1 into C.
if (m_nub > 0) {
final int nub = m_nub;
// point and solve for x. this puts all indexes 0..currNub-1 into C.
if (currNub > 0) {
{
int Lrow = 0;//m_L;
final int nskip = m_nskip;
for (int j=0; j<nub; Lrow+=nskip, ++j) {
for (int j=0; j<currNub; Lrow+=nskip, ++j) {
//memcpy(Lrow,AROW(j),(j+1)*sizeof(dReal));
memcpy(m_L, Lrow, m_A, AROWp(j), j+1);
}
}
transfer_b_to_x(m_pairsbxA, 0, nub, false);
factorMatrixAsLDLT(m_L, m_d, nub, m_nskip, 1);
solveEquationSystemWithLDLT(m_L, m_d, 0, m_pairsbxA, 0 + PBX_X, nub, m_nskip, 1, PBX__MAX);
dSetZero (m_w,nub);
transfer_b_to_x(m_pairsbxA, 0, currNub, false);
factorMatrixAsLDLT(m_L, m_d, currNub, nskip, 1);
solveEquationSystemWithLDLT(m_L, m_d, 0, m_pairsbxA, 0 + PBX_X, currNub, nskip, 1, PBX__MAX);
dSetZero (m_w,currNub);
{
int[] C = m_C;
for (int k=0; k<nub; ++k) C[k] = k;
for (int k=0; k<currNub; ++k) C[k] = k;
}
m_nC = nub;
m_nC = currNub;
}

// permute the indexes > nub such that all findex variables are at the end
// permute the indexes > currNub such that all findex variables are at the end
if (m_findex!=null) {
final int nub = m_nub;
int[] findex = m_findex;
int num_at_end = 0;
for (int k=m_n; k > nub;) {
for (int k=m_n; k > currNub;) {
--k;
if (findex[k] >= 0) {
swapProblem (m_A,m_pairsbxA,0,m_w,m_pairslh,0,m_p,m_state,findex,m_n,k,m_n-1-num_at_end,m_nskip,true);
swapProblem (m_A,m_pairsbxA,0,m_w,m_pairslh,0,m_p,m_state,findex,m_n,k,m_n-1-num_at_end,nskip,true);
num_at_end++;
}
}
Expand All @@ -711,10 +701,8 @@ private double AiN_times_qN (int i, double[] qA, int qP, int q_stride) {
// print info about indexes
/*
{
const int n = m_n;
const int nub = m_nub;
for (int k=0; k<n; k++) {
if (k<nub) printf ("C");
if (k<currNub) printf ("C");
else if ((m_pairslh + (size_t)k * PLH__MAX)[PLH_LO] == -dInfinity && (m_pairslh + (size_t)k * PLH__MAX)[PLH_HI] == dInfinity) printf ("c");
else printf (".");
}
Expand Down
13 changes: 9 additions & 4 deletions core/src/main/java/org/ode4j/ode/internal/DxBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ public double dGeomBoxPointDepth (double x, double y, double z)
// if the point is inside all six sides

double[] dist = new double[6];
// TODO CHECK TZ remove comment after 16.3: ported from latest ODE (2023-04-05)
// TODO CHECK TZ
// This is not the 0.16.3 solution but the solution from "master".
// - This is weird because the code in 0.16.3 is from 2020-11-06, master is from 2020-11-08, 0.16.3 was tagged
// much later on 2022-12-19 but it doesn´t include th master version.
// - For some reason the 0.16.3 fails the DemoCollision test (it works in C++ though).
// ---> We can just leave it as is.

boolean outside = false;
double lastOuterOffset = 0;
Expand Down Expand Up @@ -217,10 +222,10 @@ public double dGeomBoxPointDepth (double x, double y, double z)
// Otherwise, if the point is inside the box, the depth is the smallest positive distance among all the sides
double smallestDist = dist[0];
for (int i = 1; i != 6; ++i) {
if (dist[i] < smallestDist) {
smallestDist = dist[i];
if (dist[i] < smallestDist) {
smallestDist = dist[i];
}
}
}

return smallestDist;
}
Expand Down
2 changes: 1 addition & 1 deletion demo/src/main/java/org/ode4j/demo/DemoJoints.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class DemoJoints extends dsFunctions {
//static int cmd_graphics = 1;
private static boolean cmd_interactive = false;
private static boolean cmd_graphics = true;
private static int cmd_occasional_error = 1; // perturb occasionally
private static int cmd_occasional_error = 0; // perturb occasionally


// info about the current test
Expand Down
2 changes: 1 addition & 1 deletion demo/src/test/java/org/ode4j/tests/DemoJointsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class DemoJointsTest {
private static DUniversalJoint jointUniversal;


private static int cmd_occasional_error = 1; // perturb occasionally
private static int cmd_occasional_error = 0; // perturb occasionally


// info about the current test
Expand Down