Using int **const attribute arguments?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Using int **const attribute arguments?

Postby pHySiQuE » Sat May 04, 2013 5:17 pm

Several commands have gained function parameters like "int **const attribute". How do you declare this value in C++? Is it a pointer to an array of integer pointers? I haven't ever seen anything like this. Can you explain how to use it?
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Using int **const attribute arguments?

Postby pHySiQuE » Sat May 04, 2013 5:25 pm

For example, the compiler is complaining there is no matching function when I do this:
Code: Select all
      int attribute,i;
      float f0[3],f1[3];
      f0[0]=p0.x;
      f0[1]=p0.y;
      f0[2]=p0.z;
      f1[0]=p1.x;
      f1[1]=p1.y;
      f1[2]=p1.z;
      float normal[3];
      d = NewtonCollisionRayCast(collisions[0],f0,f1,&normal,&attribute);
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Using int **const attribute arguments?

Postby Julio Jerez » Sat May 04, 2013 6:50 pm

Oh that is in fact a mistake that I made.

Internally in the engine I have to change the collision attribute form and int32 to and int64.
Code: Select all
class dgContactPoint
{
   public:
   dgVector m_point;
   dgVector m_normal;
   const dgBody* m_body0;
   const dgBody* m_body1;
   const dgCollisionInstance* m_collision0;
   const dgCollisionInstance* m_collision1;

// this was a int32 in core 200
   dgInt64 m_shapeId0; 
   dgInt64 m_shapeId1;
   dgFloat32 m_penetration;
   dgUnsigned16 m_deformableIndex0;
   dgUnsigned16 m_deformableIndex1;
}DG_GCC_VECTOR_ALIGMENT;


The reason for that is that some primitives like the compound collision report pointer to child shape on that field. the this is use recursively to call make a intake and call collision on the primitive.

The problem was that in 64 bit pointer are 64 bit, therefore I could not place child chaps point into an int32, to force to be and pointe size in 32 bit or 64 bit
I made the attribute a pointer. that way the structure will be 32 bit in 32 bit and 64 bit in 64

The problem is that in look wierd
you can use like this

Code: Select all
      // set a ray cast callback for all face ray cast
                    dVector p0 (0,  100, 0, 0);
      dVector p1 (0, -100, 0, 0);
      dVector normal;
      int* id[2];
      dFloat parameter;
      parameter = NewtonCollisionRayCast (collision, &p0[0], &p1[0], &normal[0], id);

// or like this
      int* id;
      dFloat parameter;
      parameter = NewtonCollisionRayCast (collision, &p0[0], &p1[0], &normal[0], &id);
 


the values returned in int* id; are integers you

you are right, I guess that this is too weird, so I will change to and long long, and let is lose that space in 32 bit mode.
I will fix it as soon as I get the reply form Google, so that I can check into SVN again.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Using int **const attribute arguments?

Postby Julio Jerez » Sat May 04, 2013 7:32 pm

Ok I made that change already, the prototype for all attribute are lie this

Code: Select all
dFloat NewtonCollisionRayCast(const NewtonCollision* const collisionPtr, const dFloat* const p0, const dFloat* const p1, dFloat* const normal, dLong* const attribute)

the is a dLong in the Newton.h wich resolve to a long long

I will check that in as soon as I get the respond from google, by SVN is blocked because I run out of quota
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Using int **const attribute arguments?

Postby pHySiQuE » Thu May 23, 2013 1:40 am

Has the SVN repository issue been solved? Project Locker has accounts for $20/mo.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Using int **const attribute arguments?

Postby Julio Jerez » Thu May 23, 2013 8:01 am

yes they offered to give me more space, but I has already rests the archive to revision zero.
next time I just have to be more patient and be more careful of what to put in the archive.

I use to commit lot of small changes, which is fine, except that each time I added the binaries which is what bloat it up the archive.
Now I am no adding binaries as often.

you need to either delete or backup the folder when you download newton and checkout form SVN again, and it will be ok
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests