Skip to content

Commit

Permalink
Added the CPTStringFromVector() utility function.
Browse files Browse the repository at this point in the history
  • Loading branch information
eskroch committed Apr 10, 2016
1 parent 041073e commit 0ebfd13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions framework/Source/CPTUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re
NSString *__nonnull CPTStringFromPoint(CGPoint point);
NSString *__nonnull CPTStringFromSize(CGSize size);
NSString *__nonnull CPTStringFromRect(CGRect rect);
NSString *__nonnull CPTStringFromVector(CGVector vector);

/// @}

Expand Down
9 changes: 9 additions & 0 deletions framework/Source/CPTUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,15 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re
return [NSString stringWithFormat:@"{{%g, %g}, {%g, %g}}", (double)rect.origin.x, (double)rect.origin.y, (double)rect.size.width, (double)rect.size.height];
}

/** @brief Creates a string representation of the given vector.
* @param vector The vector.
* @return A string with the format <code> {dx, dy}</code>.
**/
NSString *__nonnull CPTStringFromVector(CGVector vector)
{
return [NSString stringWithFormat:@"{%g, %g}", (double)vector.dx, (double)vector.dy];
}

#pragma mark -
#pragma mark CGPoint utilities

Expand Down

0 comments on commit 0ebfd13

Please sign in to comment.