33using OpenTabletDriver . Plugin ;
44using OpenTabletDriver . Plugin . Attributes ;
55using OpenTabletDriver . Plugin . Tablet ;
6+ using OpenTabletDriver . Plugin . Timing ;
67
78namespace RadialFollow
89{
@@ -11,14 +12,14 @@ public class RadialFollowSmoothing : IFilter
1112 {
1213 public FilterStage FilterStage => FilterStage . PreTranspose ;
1314
14- [ Property ( "Outer Radius" ) , DefaultPropertyValue ( 0.75f ) , Unit ( "mm" ) , ToolTip
15+ [ Property ( "Outer Radius" ) , DefaultPropertyValue ( 1f ) , Unit ( "mm" ) , ToolTip
1516 (
1617 "Outer radius defines the max distance the cursor can lag behind the actual reading.\n \n " +
1718 "Unit of measurement is mm.\n " +
1819 "The value should be >= 0 and inner radius.\n " +
1920 "If smoothing leak is used, defines the point at which smoothing will be reduced,\n " +
2021 "instead of hard clamping the max distance between the tablet position and a cursor.\n \n " +
21- "Default value is 0.75 mm"
22+ "Default value is 1 mm"
2223 ) ]
2324 public float OuterRadius
2425 {
@@ -27,13 +28,13 @@ public float OuterRadius
2728 }
2829 private double rOuter = 0 ;
2930
30- [ Property ( "Inner Radius" ) , DefaultPropertyValue ( 0.1f ) , Unit ( "mm" ) , ToolTip
31+ [ Property ( "Inner Radius" ) , DefaultPropertyValue ( 0.05f ) , Unit ( "mm" ) , ToolTip
3132 (
3233 "Inner radius defines the max distance the tablet reading can deviate from the cursor without moving it.\n " +
3334 "This effectively creates a deadzone in which no movement is produced.\n \n " +
3435 "Unit of measurement is mm.\n " +
3536 "The value should be >= 0 and <= outer radius.\n \n " +
36- "Default value is 0.1 mm"
37+ "Default value is 0.05 mm"
3738 ) ]
3839 public float InnerRadius
3940 {
@@ -42,11 +43,11 @@ public float InnerRadius
4243 }
4344 private double rInner = 0 ;
4445
45- [ Property ( "Smoothing Coefficient" ) , DefaultPropertyValue ( 0.9f ) , ToolTip
46+ [ Property ( "Smoothing Coefficient" ) , DefaultPropertyValue ( 0.92f ) , ToolTip
4647 (
4748 "Smoothing coefficient determines how fast or slow the cursor will descend from the outer radius to the inner.\n \n " +
4849 "Possible value range is 0.0001..1, higher values mean more smoothing (slower descent to the inner radius).\n \n " +
49- "Default value is 0.9 "
50+ "Default value is 0.92 "
5051 ) ]
5152 public float SmoothingCoefficient
5253 {
@@ -55,17 +56,17 @@ public float SmoothingCoefficient
5556 }
5657 private double smoothCoef ;
5758
58- [ Property ( "Soft Knee Scale" ) , DefaultPropertyValue ( 0. 3f) , ToolTip
59+ [ Property ( "Soft Knee Scale" ) , DefaultPropertyValue ( 3f ) , ToolTip
5960 (
6061 "Soft knee scale determines how soft the transition between smoothing inside and outside the outer radius is.\n \n " +
61- "Possible value range is 0..10 , higher values mean softer transition.\n " +
62+ "Possible value range is 0..100 , higher values mean softer transition.\n " +
6263 "The effect is somewhat logarithmic, i.e. most of the change happens closer to zero.\n \n " +
63- "Default value is 0. 3"
64+ "Default value is 3"
6465 ) ]
6566 public float SoftKneeScale
6667 {
6768 get { return ( float ) knScale ; }
68- set { knScale = System . Math . Clamp ( value , 0.0f , 10 .0f) ; updateDerivedParams ( ) ; }
69+ set { knScale = System . Math . Clamp ( value , 0.0f , 100 .0f) ; updateDerivedParams ( ) ; }
6970 }
7071 private double knScale ;
7172
@@ -92,10 +93,12 @@ public Vector2 Filter(Vector2 point)
9293 double distance = direction . Length ( ) ;
9394 direction = Vector2 . Normalize ( direction ) ;
9495
95-
9696 float distToMove = ( float ) deltaFn ( distance , xOffset , scaleComp ) ;
97-
9897 cursor = cursor + Vector2 . Multiply ( direction , distToMove ) ;
98+
99+ if ( ! ( float . IsFinite ( cursor . X ) & float . IsFinite ( cursor . Y ) & stopwatch . Restart ( ) . TotalMilliseconds < 50 ) )
100+ cursor = point ;
101+
99102 return cursor ;
100103 }
101104
@@ -115,6 +118,8 @@ void updateDerivedParams()
115118 }
116119 }
117120
121+ HPETDeltaStopwatch stopwatch = new HPETDeltaStopwatch ( true ) ;
122+
118123 /// Math functions
119124
120125 double kneeFunc ( double x ) => x switch
0 commit comments