Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds
H3D.org Forum Index
   Programming Issues
     transform the haptic geometry
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
jishiben18
Posted on: 2012/5/16 10:46
Not too shy to talk
Joined: 2009/8/16
From:
Posts: 20
transform the haptic geometry
Hi All,

I am writing a new class inheritted from the X3DShapeNode.

Is there a way to turn off the default Mouse Navigation, and
instead implement my own rotation function for the graphic geometry and haptic geometry seperately ?(of course they have to work consistently with each other)

I understand how to turn off the default navigation and I tried to put my own rotation function in the render() which works fine ( now I can rotate the graphic geometry by right mouse instead of left mouse by default ), but the problem is how to control the haptic geometry?

If I don't add any code for the haptic geometry, the haptic geometry will stay static when rotating the graphic geometry.
If I add my own rotation function in the traverseSG() before X3DGeometryNode::createAndAddHapticShapes() is called, then there is no haptic feedback at all.

I am just so confused. I don't know where is the right place to add the transform function for haptic geometry.

Any help and advice will be greatly appreciated.

Thanks.
adrian
Posted on: 2012/5/16 11:38
Quite a regular
Joined: 2010/6/16
From: Constanta, Romania
Posts: 31
Re: transform the haptic geometry
Why don't you make two separate shapes ? one graphic, and one haptic. You can define the haptic one inside a ToggleGroup and set the graphicsOn=false and the hapticsOn=true. And you can move only the graphic one within the nav.

Edit: it could look like this:
<ToggleGroup DEF="VISUAL" >
    <
Transform>
        <
Shape DEF="SHAPE"/>
    </
Transform>
</
ToggleGroup>

<
ToggleGroup DEF="HAPTIC" >
    <
Transform >
        <
Shape USE="SHAPE"/>
    </
Transform>
</
ToggleGroup>


and you could move each model individually inside nav.
Hope this helps.
jishiben18
Posted on: 2012/5/18 11:07
Not too shy to talk
Joined: 2009/8/16
From:
Posts: 20
Re: transform the haptic geometry
Thanks for your suggestion adrian.

But for some reason, I just need to find the piece of code where the haptic geometry is rendered and rotated by left mouse, so that I can do some adjustion to my project.

Any tips pls?
karlu
Posted on: 2012/5/18 21:37
Guru
Joined: 2004/12/2
From: Sweden
Posts: 756
Re: transform the haptic geometry
I always turn off the default navigation. I use two scripts in the Candy package you can download from the download section: CorrectViewpoint.py and Rotator.py . The former turns off all about navigation and the second provides rotation of a transform.


----------------
KJ Lundin Palmerius
C Research
Linköping University, Sweden

jishiben18
Posted on: 2012/5/21 4:14
Not too shy to talk
Joined: 2009/8/16
From:
Posts: 20
Re: transform the haptic geometry
Thanks for your reply karlu.

I am sorry if I hadn't stated clear my question.

I know it sounds wired and it so does not accord with the structure of H3D, but i want to know is there a way to rotate the graphic geometry and haptic geometry individually, instead of rotating them together as a transform group.

like this:

<Transform >

<DeformableShape>

<IndexedTriangleSet DEF="VISUAL" containerField="geometry" />

<IndexedTriangleSet DEF="HAPTIC" USE="VISUAL" containerField="hapticGeometry" />

</DeformableShape>

</Transform>


instead of rotating the "Transform" as a whole, is there a way to rotate the two IndexedTriangleSet individually?

Thanks in advance.
jishiben18
Posted on: 2012/5/21 4:22
Not too shy to talk
Joined: 2009/8/16
From:
Posts: 20
Re: transform the haptic geometry
sorry for my terrible code last one.

<Transform>
  <
DeformableShape>
    <
IndexedTriangleSet DEF="VISUAL" containerField="geometry" />
    <
IndexedTriangleSet DEF="HAPTIC" USE="VISUAL" containerField="hapticGeometry" />
  </
DeformableShape>
</
Transform>
Markus
Posted on: 2012/5/21 9:51
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: transform the haptic geometry
The haptic shape is by default created by rendering into a specific buffer and convert the rendered triangles into a tree with a lot of of HAPI::Triangle. The triangles are rendered locally and the transformation given to the shape is the current forward transformation matrix (i.e. local to global).

It should work to update the transformation matrix in the TraverseInfo struct before the call to createandAddHaptics shapes. At least for shapes using the default haptic creation.(Sphere for example does not use the default way, but uses a HAPI::Sphere for haptic rendering).
jishiben18
Posted on: 2012/5/24 4:53
Not too shy to talk
Joined: 2009/8/16
From:
Posts: 20
Re: transform the haptic geometry
Hi Markus,

Yes that's exactly what i have been looking for.
Thank you so much. Now I managed to control the graphic geometry and haptic geometry seperately.

Regards,
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 



(C) 2012 SenseGraphics AB    ---    Powered by XOOPS