Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






C++ version of VHTK X3D node
#1
Quite a regular
Quite a regular


See User information
Hi Anyone,

I need to implement the eqivalent code below in C++;

X3D Code:
<ToggleGroup hapticsOnDevice='false, true' >
      <
VolumeHaptics stiffness="100" />
    </
ToggleGroup>  
 <
ScalarViscosityMode DEF="VolumeMode" active="true">
      <
ScalarConstantField DEF="Field" size "0.0 0.0 0.0" crop="true"/>
      <
ConstantFunction DEF="ViscConst"
        
containerField="viscosity"
        
value="0"/>
    </
ScalarViscosityMode>


C++ Code:
VolumeHapticsmyVolumeHaptics = new VolumeHaptics();
  
myVolumeHaptics->stiffness->setValue100 );
myFeatureProperties->toggleGroup->hapticsOnDevice->setValueFromString"false, true" );
myFeatureProperties->toggleGroup->children->push_backmyVolumeHaptics );

ScalarViscosityModemyScalarViscosityMode = new ScalarViscosityMode();
myScalarViscosityMode->activeDynamics->setValuetrue );
myScalarViscosityMode->velocityIndependent->setValuetrue );
//  myScalarViscosityMode->viscosity->setValue( 0 );
myFeatureProperties->toggleGroup->children->push_backmyScalarViscosityMode );
                
ScalarConstantFieldmyScalarConstantField = new ScalarConstantField();
myScalarConstantField->size->setValueVec3f(0,0,0) );
myScalarConstantField->crop->setValuetrue );
                    
ConstantFunctionmyConstantFunction = new ConstantFunction();    
myConstantFunction->value->setValue);


The ToggleGroup part works, but how do I relate the myScalarConstantField node to the ConstantFunction?

I could not find any similar examples. Any help would be greatly appreciated.


Posted on: 2011/4/28 15:40
Donnchadh Oh-Ainle (NDRC)
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: C++ version of VHTK X3D node
#2
Guru
Guru


See User information
myScalarViscosityMode->viscosity->setValue(myConstantFunction);


Posted on: 2011/5/6 10:28
KJ Lundin Palmerius
C Research
Linköping University, Sweden
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: C++ version of VHTK X3D node
#3
Quite a regular
Quite a regular


See User information
Hi Karlu,

Thanks for the help. For anyone who is interested, the code below works for using VHTK completely in cpp.

VolumeHapticsmyVolumeHaptics = new VolumeHaptics();
myVolumeHaptics->stiffness->setValue100 );
myFeatureProperties->toggleGroup->hapticsOnDevice->setValueFromString"true, true" );
myFeatureProperties->toggleGroup->children->push_backmyVolumeHaptics );
myFeatureProperties->viscValue = (float)0.7;
myFeatureProperties->forceThreshold = (float)0.95;
ScalarViscosityModemyScalarViscosityMode = new ScalarViscosityMode();
myScalarViscosityMode->activeDynamics->setValuetrue );
myScalarViscosityMode->velocityIndependent->setValuetrue );
myFeatureProperties->toggleGroup->children->push_backmyScalarViscosityMode );
ScalarConstantFieldmyScalarConstantField = new ScalarConstantField();
myScalarConstantField->size->setValueVec3f(0,0,1) );
myScalarConstantField->crop->setValuetrue );
myScalarConstantField->value->setValue);
ConstantFunctionmyConstantFunction = new ConstantFunction();    
myConstantFunction->value->setValuemyScalarConstantField->value->getValue() );
myScalarViscosityMode->viscosity->setValuemyConstantFunction );
myFeatureProperties->constantFunction myConstantFunction;

Posted on: 2011/5/9 12:02
Donnchadh Oh-Ainle (NDRC)
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





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