Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit367bda7

Browse files
sfreilichcopybara-github
authored andcommitted
Simplify sampling windows in input modeler
* For the stylus modeler, discard segments of the raw input polyline once the projection from the modeled stroke to that has passed a that portion, rather than keeping segments back to a minimum of time and number of points. The previous behavior could push forward the projection in a way that didn't make a whole lot of sense. It could prevent a degree of undesired backtracking, but the code has since been fixed to explicitly prevent the projection from backtracking along the input polyline.* For the loop contraction mitigation, determine the window of running average of speed only by duration, not by number of points. But the number of points is not equal to the number of raw inputs at that point, it's been upsampled according to `SamplingParams::min_output_rate`. So it's not actually a number of distinct raw `Input`s passed to `StrokeModeler::Update`. Instead, just use the duration-based window. If we end up needing a "min number of distinct points" as well, we can put that back, but should implement it correctly (i.e. it needs to count the actual number of raw input points before upsampling).* One very brittle test assertion is removed, and some other tests are updated.PiperOrigin-RevId: 772592177
1 parentd6c7249 commit367bda7

File tree

3 files changed

+4
-77
lines changed

3 files changed

+4
-77
lines changed

‎MODULE.bazel‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ bazel_dep(
5959

6060
git_repository(
6161
name="ink_stroke_modeler",
62-
commit="8ce40dc2a847c73a72fb92ff30ca93b2e8ada8b0",
62+
# Temporarily pointing to pending PR while that is released.
63+
commit="a50023c379021611d10ba3a06de1805008db731d",
6364
remote="https://github.com/google/ink-stroke-modeler.git",
6465
)
6566

‎ink/strokes/internal/stroke_input_modeler.cc‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ LoopContractionParams(const BrushFamily::SpringModel& spring_model,
9292
.interpolation_strength_at_speed_upper_bound =
9393
kDefaultLoopMitigationInterpolationStrengthAtSpeedUpperBound,
9494
.min_speed_sampling_window =kDefaultLoopMitigationMinSpeedSamplingWindow,
95-
.min_discrete_speed_samples =
96-
kDefaultLoopMitigationMinDiscreteSpeedSamples,
9795
};
9896
}
9997

@@ -108,7 +106,6 @@ LoopContractionParams(
108106
.interpolation_strength_at_speed_lower_bound =0.0f,
109107
.interpolation_strength_at_speed_upper_bound =0.0f,
110108
.min_speed_sampling_window =stroke_model::Duration(0),
111-
.min_discrete_speed_samples =1,
112109
};
113110
}
114111

@@ -125,16 +122,12 @@ MakeLoopContractionMitigationParameters(
125122

126123
StylusStateModelerParamsStylusModelerParams(
127124
const BrushFamily::SpringModel& spring_model) {
128-
return {.use_stroke_normal_projection =true,
129-
.min_input_samples =8,
130-
.min_sample_duration =stroke_model::Duration(0.04)};
125+
return {.use_stroke_normal_projection =true};
131126
}
132127

133128
StylusStateModelerParamsStylusModelerParams(
134129
const BrushFamily::ExperimentalRawPositionModel& raw_position_model) {
135-
return {.use_stroke_normal_projection =true,
136-
.min_input_samples =1,
137-
.min_sample_duration =stroke_model::Duration(0)};
130+
returnStylusModelerParams(BrushFamily::SpringModel{});
138131
}
139132

140133
StylusStateModelerParamsMakeStylusStateModelerParams(

‎ink/strokes/internal/stroke_input_modeler_test.cc‎

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -394,73 +394,6 @@ TEST(StrokeInputModelerTest, LargeBrushEpsilonIsRespected) {
394394
modeler.ExtendStroke(input_batches[1], input_batches[2],Duration32::Zero());
395395
modeler.ExtendStroke(input_batches[2], input_batches[3],Duration32::Zero());
396396
modeler.ExtendStroke(input_batches[3], input_batches[4],Duration32::Zero());
397-
398-
EXPECT_THAT(
399-
modeler.GetModeledInputs(),
400-
ElementsAre(
401-
ModeledStrokeInputNear({.position = {10,20},
402-
.velocity = {0,0},
403-
.acceleration = {0,0},
404-
.traveled_distance =0,
405-
.elapsed_time =Duration32::Seconds(0),
406-
.pressure =0.4,
407-
.tilt =Angle::Radians(1),
408-
.orientation =Angle::Radians(2)},
409-
0.01),
410-
ModeledStrokeInputNear({.position = {9.98,16.99},
411-
.velocity = {-1.67, -8.00},
412-
.acceleration = {-120.38, -145.56},
413-
.traveled_distance =3.01,
414-
.elapsed_time =Duration32::Seconds(2.02),
415-
.pressure =0.5,
416-
.tilt =Angle::Radians(0.80),
417-
.orientation =Angle::Radians(1.1)},
418-
0.01),
419-
ModeledStrokeInputNear({.position = {8.82,14.16},
420-
.velocity = {-4.11, -10.93},
421-
.acceleration = {-0.27, -1.92},
422-
.traveled_distance =6.07,
423-
.elapsed_time =Duration32::Seconds(2.26),
424-
.pressure =0.57,
425-
.tilt =Angle::Radians(0.97),
426-
.orientation =Angle::Radians(1.15)},
427-
0.01),
428-
ModeledStrokeInputNear({.position = {7.65,11.36},
429-
.velocity = {-4.36, -11.24},
430-
.acceleration = {-0.57, -1.82},
431-
.traveled_distance =9.1,
432-
.elapsed_time =Duration32::Seconds(2.49),
433-
.pressure =0.64,
434-
.tilt =Angle::Radians(1.13),
435-
.orientation =Angle::Radians(1.19)},
436-
0.01),
437-
ModeledStrokeInputNear({.position = {6.48,8.56},
438-
.velocity = {-4.63, -11.56},
439-
.acceleration = {-0.87, -1.71},
440-
.traveled_distance =12.14,
441-
.elapsed_time =Duration32::Seconds(2.72),
442-
.pressure =0.71,
443-
.tilt =Angle::Radians(1.30),
444-
.orientation =Angle::Radians(1.24)},
445-
0.01),
446-
ModeledStrokeInputNear({.position = {5.32,5.76},
447-
.velocity = {-4.92, -11.90},
448-
.acceleration = {-1.20, -1.59},
449-
.traveled_distance =15.17,
450-
.elapsed_time =Duration32::Seconds(2.96),
451-
.pressure =0.78,
452-
.tilt =Angle::Radians(1.46),
453-
.orientation =Angle::Radians(1.29)},
454-
0.01),
455-
ModeledStrokeInputNear({.position = {4.02,3.05},
456-
.velocity = {-0.50, -1.01},
457-
.acceleration = {0.05,0.12},
458-
.traveled_distance =18.18,
459-
.elapsed_time =Duration32::Seconds(4.98),
460-
.pressure =1,
461-
.tilt =Angle::Radians(1.3),
462-
.orientation =Angle::Radians(1.5)},
463-
0.01)));
464397
EXPECT_THAT(modeler.GetModeledInputs(),
465398
PositionsAreSeparatedByAtLeast(brush_epsilon));
466399
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp