Package turtle
Class TurtleSoup
java.lang.Object
turtle.TurtleSoup
public class TurtleSoup extends Object
-
Method Summary
Modifier and Type Method Description static double
chordLength(double radius, double angle)
Determine the length of a chord of a circle.static double
distance(Point p1, Point p2)
Calculate the distance between two points.static void
drawApproximateCircle(Turtle turtle, double radius, int numSides)
Approximate a circle by drawing a many-sided regular polygon, using only right-hand turns, and restoring the turtle's original heading and position after the drawing is complete.static void
drawPersonalArt(Turtle turtle)
Draw your personal, custom art.static void
drawSquare(Turtle turtle, int sideLength)
Draw a square.static List<Point>
findShortestPath(Set<Point> points)
Given a set of points, find a shortest path that connects the points.static Point
findTriangleIncenter(Point p1, Point p2, Point p3)
Given three non-collinear points, calculate the incenter (center of the inscribed circle) of the triangle with vertices at those points.static void
main(String[] args)
Main method.
-
Method Details
-
drawSquare
-
chordLength
-
drawApproximateCircle
-
distance
-
findTriangleIncenter
-
findShortestPath
- Parameters:
points
- input points- Returns:
- a list containing all the input points, in an order that minimizes the total length of the line segments from each point to its successor in the list (i.e., minimizing the sum of the distances from list.get(i) to list.get(i+1) for all adjacent indices i,i+1 in the list )
-
drawPersonalArt
Draw your personal, custom art. Many interesting images can be drawn using the simple implementation of a turtle. See the problem set handout for more information.- Parameters:
turtle
- the turtle context
-
main
-