We kick off with two line segments, the longer one for hypotenuse while the shorter one for one of the other sides.

    override func draw(_ rect: CGRect) {
// lineSegmentBisector()
// angleBisector()
// perpendicular()
// perpendicular2()
// parallel()
// regularTriangle()
// triangle()
// circleThroughTwoPoints()
// circleThroughThreePoints()
// pythagoreanTriples()
// squareRootOfTwo()
triangleWithHypotenuseAndSide()
}

func triangleWithHypotenuseAndSide() {
horizontalLineSegment(fromX: 100, toX: 250, y: 100)
horizontalLineSegment(fromX: 100, toX: 300, y: 150)
}

Make two perpendiculars:

    func triangleWithHypotenuseAndSide() {
horizontalLineSegment(fromX: 100, toX: 250, y: 100)
horizontalLineSegment(fromX: 100, toX: 300, y: 150)

perpendicular()
}

Use the shorter length to cut on the horizontal line of the perpendicular cross:

    func triangleWithHypotenuseAndSide() {
horizontalLineSegment(fromX: 100, toX: 250, y: 100)
horizontalLineSegment(fromX: 100, toX: 300, y: 150)

perpendicular()

UIColor.blue.setStroke()
UIBezierPath(arcCenter: CGPoint(x: 400, y: 350), radius: 150, startAngle: -1.1 * CGFloat.pi, endAngle: -0.9 * CGFloat.pi, clockwise: true).stroke()

}
    func triangleWithHypotenuseAndSide() {
horizontalLineSegment(fromX: 100, toX: 250, y: 100)
horizontalLineSegment(fromX: 100, toX: 300, y: 150)

perpendicular()

UIColor.blue.setStroke()
UIBezierPath(arcCenter: CGPoint(x: 400, y: 350), radius: 150, startAngle: -1.1 * CGFloat.pi, endAngle: -0.9 * CGFloat.pi, clockwise: true).stroke()
UIBezierPath(arcCenter: CGPoint(x: 250, y: 350), radius: 200, startAngle: 0.1 * CGFloat.pi, endAngle: 0.3 * CGFloat.pi, clockwise: true).stroke()
}
func triangleWithHypotenuseAndSide() {
horizontalLineSegment(fromX: 100, toX: 250, y: 100)
horizontalLineSegment(fromX: 100, toX: 300, y: 150)

perpendicular()

UIColor.blue.setStroke()
UIBezierPath(arcCenter: CGPoint(x: 400, y: 350), radius: 150, startAngle: -1.1 * CGFloat.pi, endAngle: -0.9 * CGFloat.pi, clockwise: true).stroke()
UIBezierPath(arcCenter: CGPoint(x: 250, y: 350), radius: 200, startAngle: 0.1 * CGFloat.pi, endAngle: 0.3 * CGFloat.pi, clockwise: true).stroke()

let hypotenuse = UIBezierPath()
hypotenuse.move(to: CGPoint(x: 250, y: 350))
hypotenuse.addLine(to: CGPoint(x: 400, y: 350 + sqrt(17500))) // 200 * 200 - 150 * 150 = 17500
UIColor.brown.setStroke()
hypotenuse.lineWidth = 3
hypotenuse.stroke()

}

--

--

--

1-on-1 tutor of chosen kids

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

School Geometry with Ruler, Compass and Coding (10)

Speed Up Website by Automatically Optimizing PNG Images for Free w/o TinyPNG!

What is TypeConverter in Room? How to use it properly

Embed Your Instagram Feed in 2020

Kubernetes from Scratch — Part 4

Creating a simple contact form using MySql and PHP in WAMP

Simplify the global pull secret update for IBM Cloud Pak deployment

Strings, Unicode, and Bytes in Python 3: Everything You Always Wanted to Know

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Golden Thumb

Golden Thumb

1-on-1 tutor of chosen kids

More from Medium

Make it clear about Weak versus Unowned

Namespace an excuse to talk about global variables

You shouldn’t migrate to Apple’s iOS if you’re…

What is the Variables and Constants in Swift Language ?