I'm trying to create simple app that tracks right wrist position and draw line (or rather path with curves) as it moves (the exact behaviour of InkCanvas control using mouse when left mouse button is pressed).
So I track position change of RightWrist and draw line this way:
public void Paint(Point startPoint, Point nextPoint, InkCanvas paintSurface)
{
Line line = new Line();
if (currentPoint.X == 0 && currentPoint.Y == 0)
{
currentPoint = new Point();
currentPoint = startPoint;
}
line.Stroke = new SolidColorBrush(currentColor);
line.StrokeThickness = 10;
line.X1 = currentPoint.X;
line.Y1 = currentPoint.Y;
line.X2 = nextPoint.X;
line.Y2 = nextPoint.Y;
currentPoint = nextPoint;
paintSurface.Children.Add(line);
}
There is no problem when I use StrokeThickness=1. In case of bigger stroke the line on curves isn't smooth (rather build with small parts), while I would like to achieve the same result as drawing on InkCanvas with mouse and its drawing attribute set to this:
<InkCanvas.DefaultDrawingAttributes>
<DrawingAttributes x:Name="attribute" Width="10" Height="10" Color="Green" />
</InkCanvas.DefaultDrawingAttributes>
The result of drawing with mouse is smooth "line".
I know you answered your own question, I just wanted to say that you can increase the "smoothness" of Kinect's joint tracking by customizing the
TransformSmoothParameters
. A good tutorial for this can be found on msdn.Three missing lines resolved my problem: