Making a Line2D in based on a Vec2D, angle and length in ToxicLibs
in
Contributed Library Questions
•
2 years ago
Is there an inbuilt way in ToxicLibs of making a Line2D in based on a Vec2D, angle and length?
- float length = 10;
- double theta = -Math.PI / 3
- position = new Vec2D(100, 100);
- float endX = (float) (length * Math.cos(theta)) + position.x;
- float endY = (float) (length * Math.sin(theta)) + position.y;
- Vec2D end = new Vec2D(endX, endY);
- lines.add(new Line2D(position, end));
1