HTP Medium Level

Toolkits.HTPMediumLevel History

Hide minor edits - Show changes to output

May 24, 2011, at 03:23 AM by 70.73.43.45 -
Added line 42:
May 24, 2011, at 03:22 AM by 70.73.43.45 -
Added line 13:
**[[#example2 | Example Using Multiple Behaviors and Weights]]
Changed line 32 from:
''Associated Parameter: Softness'''
to:
'''Associated Parameter: Softness'''
Changed line 36 from:
''Associated Parameter: Frequency'''
to:
'''Associated Parameter: Frequency'''
Changed line 40 from:
''Associated Parameter: Number of Breakpoints'''
to:
'''Associated Parameter: Number of Breakpoints'''
Added line 46:
Deleted line 47:
Added lines 55-69:

[[#example2]]
!!!Example Using Multiple Behaviors with Varying Weights
The following example combines oscillation and softness behaviors together.
(:source lang=csharp tabwidth=2 linenum=1 :) [=
HTPManager manager = manager.Instance;
HTP h = m.GetHTP(0xEF);

h.AddHeightBehavior(new SoftnessBehavior(0.5));
OscillationBehavior o = new OscillationBehavior(0.03);
// The full height of the rod is shared, twice as much for the oscillation than the softness
o.Weight = 2;
h.AddHeightBehavior(o);
=]
May 24, 2011, at 03:17 AM by 70.73.43.45 -
Changed line 10 from:
** [[#breaky || Breaky Behavior]]
to:
** [[#breaky | Breaky Behavior]]
Changed lines 22-24 from:
The medium level introduces the concept of haptic behaviors, which are a set of predefined ways in which an HTP can react to a user's input. Behaviors consider the current pressure, height, friction and in some cases even the current tick of the processor to determine a new height or friction value. Each behavior contains an associated parameter that can be adjusted. An HTP can have more than one behavior associated with it, and a behavior may be given a certain weight. Next, we explore the different kinds of haptic behaviors.

Note that behaviors can be added to
the list of height behaviors or friction behaviors.
to:
The medium level introduces the concept of haptic behaviors, which are a set of predefined ways in which an HTP can react to a user's input. Behaviors consider the current pressure, height, friction and in some cases even the current tick of the processor to determine a new height or friction value. Each behavior contains an associated parameter that can be adjusted (from 0 to 1), and also inverted when activating the invert flag. An HTP can have more than one behavior associated with it, and a behavior may be given a certain weight. Next, we explore the different kinds of haptic behaviors.

Note that
behaviors can be added to the list of height behaviors or friction behaviors. Also note that the medium level activates haptic behaviors while the puck is placed on the table and deactivated while up/away.
Changed lines 28-53 from:
The intensity behavior takes in a value from 0 to 1 and sets the height to that value. This behavior is particularly useful to simulate the low level behavior in the medium level to manually set height/friction. The name of this behavior comes from the main purpose, however, which is looking at intensity values of pixels in an image and setting the height to that value.
to:
The intensity behavior takes in a value from 0 to 1 and sets the height to that value. This behavior is particularly useful to simulate the low level behavior in the medium level to manually set height/friction. The name of this behavior comes from the main purpose, however, which is looking at intensity values of pixels in an image and setting the height to that value.
[[#softness]]
!!!Softness Behavior
''Associated Parameter: Softness'''
The softness behavior takes in a value from 0 to 1 and sets the softness of the rod to either hard or soft (respectively).
[[#oscillation]]
!!!Oscillation Behavior
''Associated Parameter: Frequency'''
The oscillation behavior takes in a value from 0 to 1 and sets the frequency in which the rod oscillates (0 no oscillation, 1 very fast oscillation).
[[#breaky]]
!!!Breaky Behavior
''Associated Parameter: Number of Breakpoints'''
The breaky behavior represents a behavior in which the pressure applied by the user has certain breakpoints in which the puck creates some resistance to simulate granularity. The number of breakpoints ranges from 0 to 10 (0 being no breakpoints and 1.0 representing 10 breakpoints).
[[#programming]]
!!Programming with the Medium Level
Programming with the medium level is much easier than the low level and it's very fun and easy. As soon as a behavior is created and associated to an HTP, it will work that way.
[[#example1]]
!!!Basic Example

The following example shows an HTP that changes heights depending on the pressure applied.
(:source lang=csharp tabwidth=2 linenum=1 :) [=
HTPManager manager = m.Instance);
HTP h = manager.GetHTP(0xEF);

h.AddHeightBehavior(new SoftnessBehavior(0.5));
=]
May 24, 2011, at 03:06 AM by 70.73.43.45 -
Added lines 1-28:
\\

>>frame<<
!!!'''Contents'''
* [[#explanation | Medium Level Concepts]]
* [[#behaviors | Haptic Behaviors]]
** [[#intensity | Intensity Behavior]]
** [[#softness | Softness Behavior]]
** [[#oscillation | Oscillation Behavior]]
** [[#breaky || Breaky Behavior]]
* [[#programming | Programming with the Medium Level]]
**[[#example1 | Basic Example]]
>><<
\\

[[#explanation]]
!!Medium Level Concepts
Using the medium level when working with the HTP Toolkit, the users have a set of predefined tools that allows them to quickly create haptic applications. By default, the medium level does not require enabling. However, because it can be combined with the high level, if the user desires to exclusively use the medium level, he/she may change the weight corresponding to widgets to 0 (advanced tutorial), or may disable hit testing.

[[#behaviors]]
!!Haptic Behaviors
The medium level introduces the concept of haptic behaviors, which are a set of predefined ways in which an HTP can react to a user's input. Behaviors consider the current pressure, height, friction and in some cases even the current tick of the processor to determine a new height or friction value. Each behavior contains an associated parameter that can be adjusted. An HTP can have more than one behavior associated with it, and a behavior may be given a certain weight. Next, we explore the different kinds of haptic behaviors.

Note that behaviors can be added to the list of height behaviors or friction behaviors.
[[#intensity]]
!!!Intensity Behavior
'''Associated Parameter: Intensity'''
The intensity behavior takes in a value from 0 to 1 and sets the height to that value. This behavior is particularly useful to simulate the low level behavior in the medium level to manually set height/friction. The name of this behavior comes from the main purpose, however, which is looking at intensity values of pixels in an image and setting the height to that value.