Skip to content

Commit 0ebfd13

Browse files
committed
Added the CPTStringFromVector() utility function.
1 parent 041073e commit 0ebfd13

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎framework/Source/CPTUtilities.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re
133133
NSString *__nonnull CPTStringFromPoint(CGPoint point);
134134
NSString *__nonnull CPTStringFromSize(CGSize size);
135135
NSString *__nonnull CPTStringFromRect(CGRect rect);
136+
NSString *__nonnull CPTStringFromVector(CGVector vector);
136137

137138
/// @}
138139

‎framework/Source/CPTUtilities.m‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,15 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re
976976
return [NSString stringWithFormat:@"{{%g, %g}, {%g, %g}}", (double)rect.origin.x, (double)rect.origin.y, (double)rect.size.width, (double)rect.size.height];
977977
}
978978

979+
/** @brief Creates a string representation of the given vector.
980+
* @param vector The vector.
981+
* @return A string with the format <code> {dx, dy}</code>.
982+
**/
983+
NSString *__nonnull CPTStringFromVector(CGVector vector)
984+
{
985+
return [NSString stringWithFormat:@"{%g, %g}", (double)vector.dx, (double)vector.dy];
986+
}
987+
979988
#pragma mark -
980989
#pragma mark CGPoint utilities
981990

0 commit comments

Comments
 (0)