{"id":23168846,"url":"https://github.com/chris-huxtable/cbhgeometrykit","last_synced_at":"2025-04-04T22:45:00.605Z","repository":{"id":56904213,"uuid":"225220764","full_name":"chris-huxtable/CBHGeometryKit","owner":"chris-huxtable","description":"Expanded and consistently named tools for managing Foundation geometry.","archived":false,"fork":false,"pushed_at":"2020-01-03T22:35:02.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T02:37:18.733Z","etag":null,"topics":["foundation","geometry","objective-c","objective-c-library"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chris-huxtable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-01T19:50:30.000Z","updated_at":"2020-01-03T22:30:23.000Z","dependencies_parsed_at":"2022-08-21T01:50:53.347Z","dependency_job_id":null,"html_url":"https://github.com/chris-huxtable/CBHGeometryKit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-huxtable%2FCBHGeometryKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-huxtable%2FCBHGeometryKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-huxtable%2FCBHGeometryKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-huxtable%2FCBHGeometryKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chris-huxtable","download_url":"https://codeload.github.com/chris-huxtable/CBHGeometryKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261581,"owners_count":20910107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foundation","geometry","objective-c","objective-c-library"],"created_at":"2024-12-18T03:13:52.335Z","updated_at":"2025-04-04T22:45:00.582Z","avatar_url":"https://github.com/chris-huxtable.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CBHGeometryKit\n\n[![release](https://img.shields.io/github/release/chris-huxtable/CBHGeometryKit.svg)](https://github.com/chris-huxtable/CBHGeometryKit/releases)\n[![pod](https://img.shields.io/cocoapods/v/CBHGeometryKit.svg)](https://cocoapods.org/pods/CBHGeometryKit)\n[![licence](https://img.shields.io/badge/licence-ISC-lightgrey.svg?cacheSeconds=2592000)](https://github.com/chris-huxtable/CBHGeometryKit/blob/master/LICENSE)\n[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg?cacheSeconds=2592000)](https://github.com/chris-huxtable/CBHGeometryKit)\n\n`CBHGeometryKit` provides a consistent interface for dealing with Foundation geometry types and expands on existing functions to make a number of other operations easier.\n\nSpecifically it provides functions for:\n- `NSPoint`\n- `NSSize`\n- `NSRect`\n- `NSRange`\n\n\n## `NSPoint`\n```objective-c\n#pragma mark - Creating Points\n\nNSPoint NSPoint_init(CGFloat x, CGFloat y);\nNSPoint NSPoint_initWithString(NSString *string);\nNSPoint NSPoint_initZero(void);\n\n\n#pragma mark - Checking Points\n\nBOOL NSPoint_isEqual(NSPoint point, NSPoint other);\n\n\n#pragma mark - Derived Points\n\nNSPoint NSPoint_truncate(NSPoint point);\nNSPoint NSPoint_round(NSPoint point);\n\nNSPoint NSPoint_shift(NSPoint point, NSPoint delta);\nNSPoint NSPoint_shiftParametric(NSPoint point, CGFloat dX, CGFloat dY);\n\nNSPoint NSPoint_nearestPixel(NSPoint point);\n\n\n#pragma mark - Distance\n\nCGFloat NSPoint_distance(NSPoint start, NSPoint end);\nCGFloat NSPoint_distanceSquared(NSPoint start, NSPoint end);\n\n\n#pragma mark - Description\n\nNSString *NSPoint_description(NSPoint point);\n```\n\n\n## `NSSize`\n```objective-c\n#pragma mark - Creating Sizes\n\nNSSize NSSize_init(CGFloat width, CGFloat height);\nNSSize NSSize_initWithString(NSString *string);\nNSSize NSSize_initEmpty(void);\n\n\n#pragma mark - Checking Sizes\n\nBOOL NSSize_isEmpty(NSSize size);\nBOOL NSSize_isNegative(NSSize size);\nBOOL NSSize_isEqual(NSSize size, NSSize other);\n\n\n#pragma mark - Derived Sizes\n\nNSSize NSSize_truncate(NSSize size);\nNSSize NSSize_round(NSSize size);\nNSSize NSSize_absolute(NSSize size);\n\nNSSize NSSize_scale(NSSize size, NSSize delta);\nNSSize NSSize_scaleParametric(NSSize size, CGFloat dWidth, CGFloat dHeight);\n\n\n#pragma mark - Description\n\nNSString *NSSize_description(NSSize size);\n```\n\n\n## `NSRect`\n```objective-c\n#pragma mark - Creating Rects\n\nNSRect NSRect_init(CGFloat x, CGFloat y, CGFloat width, CGFloat height);\nNSRect NSRect_initWithStructs(NSPoint origin, NSSize size);\nNSRect NSRect_initWithSize(NSSize size);\nNSRect NSRect_initWithString(NSString *string);\nNSRect NSRect_initEmpty(void);\n\n\n#pragma mark - Checking Rects\n\nBOOL NSRect_isEmpty(NSRect rect);\nBOOL NSRect_isNegative(NSRect rect);\nBOOL NSRect_isEqual(NSRect rect, NSRect other);\n\nBOOL NSRect_isCovering(NSRect rect, NSRect other);\nBOOL NSRect_isIntersecting(NSRect rect, NSRect other);\n\nBOOL NSRect_isPointInRect(NSRect rect, NSPoint point);\nBOOL NSRect_isMouseInRect(NSRect rect, NSPoint point, BOOL flipped);\n\n\n#pragma mark - Derived Rects\n\nNSRect NSRect_inset(NSRect rect, CGFloat dX, CGFloat dY);\nNSRect NSRect_offset(NSRect rect, CGFloat dX, CGFloat dY);\n\nNSRect NSRect_integral(NSRect rect);\nNSRect NSRect_truncate(NSRect rect);\nNSRect NSRect_round(NSRect rect);\nNSRect NSRect_absolute(NSRect rect);\n\nNSRect NSRect_alignWithPixels(NSRect rect);\n\nNSRect NSRect_intersection(NSRect rect, NSRect other);\nNSRect NSRect_union(NSRect rect, NSRect other);\n\nNSRect NSRect_centeredInRect(NSRect rect, NSRect inRect);\n\n\n#pragma mark - Derived Points\n\nNSPoint NSRect_minPoint(NSRect rect);\nNSPoint NSRect_midPoint(NSRect rect);\nNSPoint NSRect_maxPoint(NSRect rect);\n\n\n#pragma mark - Calculated Properties\n\nCGFloat NSRect_maxX(NSRect rect);\nCGFloat NSRect_maxY(NSRect rect);\n\nCGFloat NSRect_midX(NSRect rect);\nCGFloat NSRect_midY(NSRect rect);\n\nCGFloat NSRect_minX(NSRect rect);\nCGFloat NSRect_minY(NSRect rect);\n\n\n#pragma mark - Description\n\nNSString *NSRect_description(NSRect rect);\n```\n\n\n## `NSRange`\n```objective-c\n#pragma mark - Creating Ranges\n\nNSRange NSRange_init(NSUInteger location, NSUInteger length);\nNSRange NSRange_initFromTo(NSUInteger from, NSUInteger to);\nNSRange NSRange_initWithString(NSString *string);\nNSRange NSRange_initEmpty();\n\n\n#pragma mark - Checking Range\n\nBOOL NSRange_isEmpty(NSRange range);\nBOOL NSRange_isEqual(NSRange range, NSRange other);\nBOOL NSRange_isLocationInRange(NSRange range, NSUInteger location);\n\n\n#pragma mark - Derived Ranges\n\nNSRange NSRange_intersection(NSRange range, NSRange other);\nNSRange NSRange_union(NSRange range, NSRange other);\n\n\n#pragma mark - Calculated Properties\n\nNSUInteger NSRange_max(NSRange range);\nNSUInteger NSRange_locationAtOffset(NSRange range, NSUInteger offset);\n\n\n#pragma mark - Description\n\nNSString *NSRange_description(NSRange range);\n```\n\n\n## Licence\nCBHGeometryKit is available under the [ISC license](https://github.com/chris-huxtable/CBHGeometryKit/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-huxtable%2Fcbhgeometrykit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris-huxtable%2Fcbhgeometrykit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-huxtable%2Fcbhgeometrykit/lists"}