Skip to content

Commit

Permalink
move link to Paul Bourke's homepage to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlokorte committed Jan 8, 2016
1 parent 2981ba4 commit cc60e82
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ReformMath/ReformMath/Intersection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
// Copyright © 2015 Laszlo Korte. All rights reserved.
//

//
// The intersection algorithms are based on
// the ones provided by Paul Bourke
// http://paulbourke.net/geometry/
//

func intersection(range rangeA: AngleRange, range rangeB: AngleRange) -> AngleRange? {
let from = max(rangeA.start, rangeB.start)
let to = min(rangeA.end, rangeB.end)
Expand All @@ -18,8 +24,6 @@ func intersection(range rangeA: AngleRange, range rangeB: AngleRange) -> AngleRa
}

public func intersection(line lineA: LineSegment2d, line lineB: LineSegment2d) -> Vec2d? {
// ref http://paulbourke.net/geometry/pointlineplane/

let d = (lineB.to.y - lineB.from.y) * (lineA.to.x - lineA.from.x) - (lineB.to.x - lineB.from.x) * (lineA.to.y - lineA.from.y)

let na = (lineB.to.x - lineB.from.x) * (lineA.from.y - lineB.from.y) - (lineB.to.y - lineB.from.y) * (lineA.from.x - lineB.from.x)
Expand Down

0 comments on commit cc60e82

Please sign in to comment.