public void AddChild(double degree = 0, double length = 100) { var connectionPoint = new Point(Anchor.X + Length * 0.8 * Math.Cos(RotationDegree * Math.PI / 180), Anchor.Y + Length * 0.8 * Math.Sin(RotationDegree * Math.PI / 180)); ChildConnection = new StickConnection(connectionPoint.X, connectionPoint.Y, degree + RotationDegree, length); }
public GearAndStick(double x, double y, double r, double d) { Gear = new Gear(x, y) { Radius = r }; d = d < r ? (d > 0 ? d : 1) : r - 1; DistanceFromCenter = d; Stick = new StickConnection(x + DistanceFromCenter, y); }
private void ForwardKinematics(StickConnection parent, StickConnection childConnection, double degrees) { if (childConnection != null) { var connectionPoint = new Point(parent.Anchor.X + parent.Length * 0.8 * Math.Cos(parent.RotationDegree * Math.PI / 180), parent.Anchor.Y + parent.Length * 0.8 * Math.Sin(parent.RotationDegree * Math.PI / 180)); childConnection.Anchor = connectionPoint; childConnection.RotationDegree += degrees; ForwardKinematics(childConnection, childConnection.ChildConnection, degrees); } }