<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I would like to see a full Geometry implementation but I don't think it should be part of the standard library.<div class=""><br class=""></div><div class="">I've kicked around some ideas here: </div><div class=""><br class=""></div><div class="">* <a href="https://gist.github.com/erica/8cb4b21cf0c429828fad1d8ad459b71b" class="">https://gist.github.com/erica/8cb4b21cf0c429828fad1d8ad459b71b</a></div><div class="">* <a href="https://gist.github.com/erica/ee06008202c9fed699bfa6254c42c721" class="">https://gist.github.com/erica/ee06008202c9fed699bfa6254c42c721</a></div><div class=""><br class=""></div><div class="">and</div><div class=""><br class=""></div><div class="">* <a href="https://github.com/erica/SwiftGeometry" class="">https://github.com/erica/SwiftGeometry</a><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 13, 2018, at 7:49 PM, Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Evolution,<div class=""><br class=""></div><div class="">I would <i class="">really</i> like to see Swift gain an Angle type in the standard library. Every time I have to deal with an angle in an api, I have to go figure out the conventions for that call. Is it in degrees? Is it in radians? What if it is in radians, but I want to think about it in degrees?</div><div class=""><br class=""></div><div class="">I ended up writing an Angle type for my own code a few years back, and I have to say it is really wonderful. It has greatly simplified my graphics work. It takes a lot of mental load off of my brain when dealing with Angles.</div><div class=""><br class=""></div><div class="">I can of course initialize it either as degrees or radians (or revolutions), but I can also just say things like ‘.threeQuarterTurn’, and then I can get the value back out in whatever format I like. There are also useful additions that let me normalize the angle to different ranges and which let me snap to the nearest multiple of an angle. Both of these are enormously useful for user facing features. I can also do math on angles in a way that makes geometric sense for angles. It is also really useful for interacting with CGVectors in intelligent ways.</div><div class=""><br class=""></div><div class="">Using Doubles or CGFloats to represent angles everywhere is just semantically wrong IMHO, and it stops us from adding all of these angle-specific niceties.</div><div class=""><br class=""></div><div class="">Happy to provide code if there is interest…</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>