Skip to content

Commit

Permalink
Removes not needed cast between Double and CGFloat
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriyvan committed Jan 5, 2019
1 parent 0a343c6 commit 4a89077
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion WeScan/Scan/ScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ extension ScannerViewController: RectangleDetectionDelegateProtocol {
let scaleTransform = CGAffineTransform.scaleTransform(forSize: portraitImageSize, aspectFillInSize: quadView.bounds.size)
let scaledImageSize = imageSize.applying(scaleTransform)

let rotationTransform = CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2.0))
let rotationTransform = CGAffineTransform(rotationAngle: CGFloat.pi / 2.0)

let imageBounds = CGRect(origin: .zero, size: scaledImageSize).applying(rotationTransform)

Expand Down
12 changes: 6 additions & 6 deletions WeScanTests/QuadrilateralTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ final class QuadrilateralTests: XCTestCase {
var fromImageSize = CGSize(width: 500.0, height: 500.0)
var toImageSize = CGSize(width: 500.0, height: 500.0)

var scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
var scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: CGPoint(x: 500.0, y: 0.0)))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 500.0, y: 500.0)))
Expand All @@ -95,7 +95,7 @@ final class QuadrilateralTests: XCTestCase {
fromImageSize = CGSize(width: 1000.0, height: 500.0)
toImageSize = CGSize(width: 500.0, height: 1000.0)

scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: .zero))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 0.0, y: 1000.0)))
Expand All @@ -112,7 +112,7 @@ final class QuadrilateralTests: XCTestCase {
fromImageSize = CGSize(width: 1000.0, height: 500.0)
toImageSize = CGSize(width: 250.0, height: 500.0)

scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: .zero))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 0.0, y: 500.0)))
Expand All @@ -129,7 +129,7 @@ final class QuadrilateralTests: XCTestCase {
fromImageSize = CGSize(width: 750.0, height: 750.0)
toImageSize = CGSize(width: 750.0, height: 750.0)

scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: CGPoint(x: 250.0, y: 250.0)))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 250.0, y: 500.0)))
Expand All @@ -146,7 +146,7 @@ final class QuadrilateralTests: XCTestCase {
fromImageSize = CGSize(width: 1000.0, height: 750.0)
toImageSize = CGSize(width: 1500.0, height: 2000.0)

scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: CGPoint(x: 500.0, y: 500.0)))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 500.0, y: 1500.0)))
Expand All @@ -163,7 +163,7 @@ final class QuadrilateralTests: XCTestCase {
fromImageSize = CGSize(width: 1000.0, height: 500.0)
toImageSize = CGSize(width: 1000.0, height: 2000.0)

scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat(Double.pi / 2.0))
scaledQuad = quad.scale(fromImageSize, toImageSize, withRotationAngle: CGFloat.pi / 2.0)

XCTAssertTrue(scaledQuad.topLeft.isWithin(delta: 0.01, ofPoint: CGPoint(x: 200.0, y: 200.0)))
XCTAssertTrue(scaledQuad.topRight.isWithin(delta: 0.01, ofPoint: CGPoint(x: 200.0, y: 400.0)))
Expand Down

0 comments on commit 4a89077

Please sign in to comment.