Lines Matching refs:vel

65 SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, double velocity,
68 GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
96 InitVelocityData(DeviceVelocityPtr vel)
98 memset(vel, 0, sizeof(DeviceVelocityRec));
100 vel->corr_mul = 10.0; /* dots per 10 millisecond should be usable */
101 vel->const_acceleration = 1.0; /* no acceleration/deceleration */
102 vel->reset_time = 300;
103 vel->use_softening = 1;
104 vel->min_acceleration = 1.0; /* don't decelerate */
105 vel->max_rel_diff = 0.2;
106 vel->max_diff = 1.0;
107 vel->initial_range = 2;
108 vel->average_accel = TRUE;
109 SetAccelerationProfile(vel, AccelProfileClassic);
110 InitTrackers(vel, 16);
117 FreeVelocityData(DeviceVelocityPtr vel)
119 free(vel->tracker);
120 SetAccelerationProfile(vel, PROFILE_UNINITIALIZE);
130 DeviceVelocityPtr vel;
135 vel = calloc(1, sizeof(DeviceVelocityRec));
137 if (!vel || !schemeData) {
138 free(vel);
142 InitVelocityData(vel);
143 schemeData->vel = vel;
145 if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
146 FreeVelocityData(vel);
147 free(vel);
162 DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
164 if (vel) {
171 FreeVelocityData(vel);
172 free(vel);
194 DeviceVelocityPtr vel;
202 vel = GetDevicePredictableAccelData(dev);
203 if (!vel)
211 if (GetAccelerationProfile(vel, profile) == NULL)
215 SetAccelerationProfile(vel, profile);
221 AccelInitProfileProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
223 int profile = vel->statistics.profile_number;
239 DeviceVelocityPtr vel;
247 vel = GetDevicePredictableAccelData(dev);
248 if (!vel)
258 vel->const_acceleration = 1 / v;
264 AccelInitDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
266 float fval = 1.0 / vel->const_acceleration;
309 AccelInitAdaptDecelProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
311 float fval = 1.0 / vel->min_acceleration;
330 DeviceVelocityPtr vel;
338 vel = GetDevicePredictableAccelData(dev);
339 if (!vel)
351 vel->corr_mul = v;
357 AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
359 float fval = vel->corr_mul;
371 DeviceVelocityPtr vel,
377 if (!vel)
384 schemeData->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
385 schemeData->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
386 schemeData->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
387 schemeData->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
396 DeviceVelocityPtr vel;
409 vel = GetDevicePredictableAccelData(dev);
410 if (vel) {
427 InitTrackers(DeviceVelocityPtr vel, int ntracker)
433 free(vel->tracker);
434 vel->tracker = (MotionTrackerPtr) calloc(ntracker, sizeof(MotionTracker));
435 vel->num_tracker = ntracker;
562 FeedTrackers(DeviceVelocityPtr vel, double dx, double dy, int cur_t)
566 for (n = 0; n < vel->num_tracker; n++) {
567 vel->tracker[n].dx += dx;
568 vel->tracker[n].dy += dy;
570 n = (vel->cur_tracker + 1) % vel->num_tracker;
571 vel->tracker[n].dx = 0.0;
572 vel->tracker[n].dy = 0.0;
573 vel->tracker[n].time = cur_t;
574 vel->tracker[n].dir = GetDirection(dx, dy);
576 dx, dy, vel->tracker[n].dir,
577 cur_t - vel->tracker[vel->cur_tracker].time);
578 vel->cur_tracker = n;
606 QueryTrackers(DeviceVelocityPtr vel, int cur_t)
612 double velocity_factor = vel->corr_mul * vel->const_acceleration; /* premultiply */
615 for (offset = 1; offset < vel->num_tracker; offset++) {
616 MotionTracker *tracker = TRACKER(vel, offset);
622 if (age_ms >= vel->reset_time || age_ms < 0) {
624 vel->reset_time, age_ms);
644 if ((initial_velocity == 0 || offset <= vel->initial_range) &&
653 if (velocity_diff > vel->max_diff &&
655 vel->max_rel_diff) {
669 if (offset == vel->num_tracker) {
671 used_offset = vel->num_tracker - 1;
675 MotionTracker *tracker = TRACKER(vel, used_offset);
693 ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time)
697 vel->last_velocity = vel->velocity;
699 FeedTrackers(vel, dx, dy, time);
701 velocity = QueryTrackers(vel, time);
705 vel->velocity = velocity;
728 * Soften the delta based on previous deltas stored in vel.
734 ApplySoftening(DeviceVelocityPtr vel, double *fdx, double *fdy)
736 if (vel->use_softening) {
737 *fdx = ApplySimpleSoftening(vel->last_dx, *fdx);
738 *fdy = ApplySimpleSoftening(vel->last_dy, *fdy);
743 ApplyConstantDeceleration(DeviceVelocityPtr vel, double *fdx, double *fdy)
745 *fdx *= vel->const_acceleration;
746 *fdy *= vel->const_acceleration;
754 DeviceVelocityPtr vel,
760 result = vel->Profile(dev, vel, velocity, threshold, acc);
763 if (result < vel->min_acceleration)
764 result = vel->min_acceleration;
775 DeviceVelocityPtr vel, double threshold, double acc)
779 if (vel->velocity <= 0) {
787 if (vel->average_accel && vel->velocity != vel->last_velocity) {
793 BasicComputeAcceleration(dev, vel, vel->velocity, threshold, acc);
795 BasicComputeAcceleration(dev, vel, vel->last_velocity, threshold,
798 4.0 * BasicComputeAcceleration(dev, vel,
799 (vel->last_velocity +
800 vel->velocity) / 2,
805 vel->velocity, vel->last_velocity, result);
808 result = BasicComputeAcceleration(dev, vel,
809 vel->velocity, threshold, acc);
811 vel->velocity, result);
826 DeviceVelocityPtr vel,
838 DeviceVelocityPtr vel,
842 return SimpleSmoothProfile(dev, vel, velocity, threshold, acc);
845 return PolynomialAccelerationProfile(dev, vel, velocity, 0, acc);
859 DeviceVelocityPtr vel,
867 return vel->min_acceleration;
869 return (pow(acc, vel_dist)) * vel->min_acceleration;
893 DeviceVelocityPtr vel,
915 DeviceVelocityPtr vel,
938 res += vel->min_acceleration;
948 DeviceVelocityPtr vel,
958 res = CalcPenumbralGradient(velocity) * (acc - vel->min_acceleration);
960 return vel->min_acceleration + res;
965 DeviceVelocityPtr vel,
973 DeviceVelocityPtr vel, double velocity, double threshold, double acc)
979 GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num)
985 return vel->deviceSpecificProfile;
1016 SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num)
1020 profile = GetAccelerationProfile(vel, profile_num);
1026 free(vel->profile_private);
1027 vel->profile_private = NULL;
1029 vel->Profile = profile;
1030 vel->statistics.profile_number = profile_num;
1048 SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
1051 if (vel)
1052 vel->deviceSpecificProfile = profile;
1070 dev->valuator->accelScheme.accelData)->vel;