本文整理汇总了C#中Position.GetVelocity方法的典型用法代码示例。如果您正苦于以下问题:C# Position.GetVelocity方法的具体用法?C# Position.GetVelocity怎么用?C# Position.GetVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.GetVelocity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
PointD normalVector;
PointD nearPt;
double radius;
ExtendedNormalOfPoint(m.GetVirtualPointD(), out normalVector, out nearPt, out radius);
PointD dir = PointD.Orthogonal(normalVector);
PointD normalComponent = PointD.DotProduct(dir, m.GetVelocity()) * dir;
PointD tangentComponent = m.GetVelocity() - normalComponent;
return -1 * tangentComponent * m_Param.C;
}
示例2: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
PointD dir = m_Param.V;
PointD normalComponent = PointD.DotProduct(dir, m.GetVelocity()) * dir;
PointD tangentComponent = m.GetVelocity() - normalComponent;
if (normalComponent.Magnitude() > tangentComponent.Magnitude())
{
return -1 * tangentComponent * m_Param.C;
}
else
{
return -1 * normalComponent * m_Param.C;
}
//if (Math.Abs(m.GetVelocity().X ) > Math.Abs(m.GetVelocity().Y))
//{
// return new PointD(0, -m.GetVelocity().Y * .5);
//}
//else if (Math.Abs(m.GetVelocity().X) < Math.Abs(m.GetVelocity().Y))
//{
// return new PointD(-m.GetVelocity().X * .5, 0);
//}
//else
//{
// return PointD.Empty;
//}
}
示例3: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
Bitmap i = (Bitmap)m_img;
Color c = i.GetPixel(m.GetVirtualPoint().X - m_offset.X,
m.GetVirtualPoint().Y - m_offset.Y);
PointD orig = m.GetVelocity();
return orig * -m_Param.C * (255 - c.G) / 255.0;
}
示例4: ParameterizedMousePosition
public ParameterizedMousePosition(Position.IVirtualMousePosition mousePos, int fakeTime)
{
m_mouse = mousePos;
m_newPosition = mousePos.GetVirtualPointD();
m_newAcceleration = mousePos.GetAcceleration();
m_newVelocity = mousePos.GetVelocity();
m_newDisplacement = m_mouse.GetDisplacement();
m_fakeTime = fakeTime;
}
示例5: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
double speed = m.GetVelocity().Magnitude();
if (speed > 0.01)
{
PointD dir = PointD.UnitVector(PointD.DotProduct(m_Param.V, PointD.UnitVector(m.GetVelocity())) * m_Param.V);
PointD usr = PointD.UnitVector(m.GetVelocity());
// this will deaden any movement (dir is NULL, usr is NULL :: no movement of the cursor)
if (dir.Magnitude() < 0.001)
usr = dir;
return -1 * m.GetVelocity()
+ PointD.UnitVector(m_Param.C * dir + (1 - m_Param.C) * usr) * speed;
}
else
{
return -1 * m.GetVelocity();
}
}
示例6: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
PointD direction = m.GetUnitDirection();
if (direction.Magnitude() > 0.1)
{
m_direction = direction * 0.1 + m_direction * 0.9; // mixture of previous and current input
}
if (m_direction.Magnitude() > Render.DrawHelper.MIN_SPEED_SENSITIVITY)
{
m_direction = m_direction / m_direction.Magnitude(); // unit vector
m_Param.V = m_direction; // direction stored internally, but exposed
PointD velParallel;
// prevent motion retracing the path (going in opposite direction)
if (PointD.DotProduct(m_direction, m.GetVelocity()) > 0)
{
velParallel = PointD.DotProduct(m_direction, m.GetVelocity()) * m_direction;
}
else
{
// curving opposite motion slightly until more direction events received
// (how much velocity to go backwards)
velParallel = PointD.DotProduct(m_direction, m.GetVelocity()) * -(1 - m_Param.C) * m_direction;
//m_direction = -0.5 * m_direction;
//velParallel = PointD.DotProduct(m_direction, m.GetVelocity()) * m_direction;// PointD.DotProduct(m_direction, m.GetVelocity()) * -(1 - m_Param.C) * m_direction;
}
PointD origVelocityTangent = PointD.DotProduct(m_direction, m.GetVelocity()) * m_direction;
PointD origVelocityNormal = PointD.DotProduct(PointD.Orthogonal(m_direction), m.GetVelocity()) * PointD.Orthogonal(m_direction);
// first cancel out the original velocity, then put the new one in
return -1 * origVelocityTangent + -m_Param.C * origVelocityNormal + velParallel;
}
else
{
return PointD.Empty;
}
}
示例7: Compute
public void Compute(Position.IVirtualMousePosition mousePosition, out bool filtersChanged)
{
int i = 0;
PointD sumVel = mousePosition.GetVelocity();
PointD sumAccel = mousePosition.GetAcceleration();
PointD displ = mousePosition.GetDisplacement();
Position.ParameterizedMousePosition mp = new Position.ParameterizedMousePosition(mousePosition);
int numInUse = 0;// instrumentation
filtersChanged = false; // flag out if filter state changes
for (i = 0; i < m_Filters.Count; i++)
{
if (m_Filters[i].Parameters.FilterEnabled )
{
if (m_Filters[i].HitTest(mousePosition.GetVirtualPointD()))
{
if (!m_Filters[i].Parameters.InUse)
m_Filters[i].Parameters.UseCounter++;
if (!m_Filters[i].Parameters.InUse)
filtersChanged = true;
m_Filters[i].Parameters.InUse = true;
numInUse++;// instrumentation
PointD vel = m_Filters[i].GetVelocity(mp);
if (!(double.IsNaN(vel.X) || double.IsInfinity(vel.X)
|| double.IsNaN(vel.Y) || double.IsNaN(vel.Y)))
{
sumVel += vel;
mp.SetVelocity(sumVel);
}
}
else
{
if (m_Filters[i].Parameters.InUse)
filtersChanged = true;
m_Filters[i].Parameters.InUse = false;
}
}
}
m_maxNumInUse = Math.Max(numInUse, m_maxNumInUse); // instrumentation
m_computedAcceleration = sumAccel;
m_computedVelocity = sumVel;
}
示例8: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
// velocity restriction
double speed = m.GetSpeed();
double speedLimit = m_Param.C * 10 * GetStrength(m.GetVirtualPointD());
if (speed > speedLimit)
{
PointD maxParts = new PointD(speedLimit * m.GetUnitDirection().X, speedLimit * m.GetUnitDirection().Y);
return -1 * m.GetVelocity() + maxParts;
}
else
{
return PointD.Empty;
}
}
示例9: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
PointD orig = m.GetVelocity();
return orig * (1 + m_Param.C) * GetStrength(m.GetVirtualPointD());
}
示例10: GetVelocity
public override PointD GetVelocity(Position.IVirtualMousePosition m)
{
m_previousVelocity = m_previousVelocity * ( 1 - Math.Pow(m_Param.C - 1, 2)) + m.GetVelocity() * 0.3;
return m_previousVelocity;
}