//----------------------------------------------------------------------------- // Project GeometryKit // Class G3DTuple2d // Creator Philippe C.D. Robert // Maintainer Philippe C.D. Robert // Creation Date Thu Sep 9 11:05:08 CEST 1999 // // Copyright (c) Philippe C.D. Robert // // The GeometryKit is free software; you can redistribute it and/or modify it // under the terms of the GNU LGPL Version 2 as published by the Free // Software Foundation // // $Id: G3DTuple2d.h,v 1.5 2001/01/05 20:50:49 robert Exp $ //----------------------------------------------------------------------------- #ifndef __G3DTuple2d_h_INCLUDE #define __G3DTuple2d_h_INCLUDE #import @interface G3DTuple2d : NSObject { double tuple[2]; } //----------------------------------------------------------------------------- // Class methods //----------------------------------------------------------------------------- + (void)initialize; + (G3DTuple2d *)tuple2d; + (G3DTuple2d *)tuple2dWithElements:(double *)vals; + (G3DTuple2d *)tuple2dWithX:(double)x y:(double)y; + (G3DTuple2d *)tuple2dWithTuple2d:(G3DTuple2d *)aTuple; //----------------------------------------------------------------------------- // init and free //----------------------------------------------------------------------------- - (id)init; // Initialises a new tuple by invoking initWithElements - (id)initWithElements:(double *)vals; - (id)initWithX:(double)x y:(double)y; - (id)initWithTuple:(G3DTuple2d *)aTuple; // Initialises a new tuple by invoking initWithElements //----------------------------------------------------------------------------- // Math //----------------------------------------------------------------------------- - (void)absolute; - (void)clamp; - (void)clampLow:(double)low high:(double)high; - (void)addTuple2d:(G3DTuple2d *)aTuple; - (void)subTuple2d:(G3DTuple2d *)aTuple; - (void)multiplyBy:(double)aScalar; - (void)divideBy:(double)aScalar; - (void)interpolateBetween:(G3DTuple2d *)first and:(G3DTuple2d *)second factor:(double)factor; // (1-factor)*first + factor*second - (void)negate; - (BOOL)isEqualToTuple:(id)anObj; //----------------------------------------------------------------------------- // Accessing //----------------------------------------------------------------------------- - (double *)elements; - (void)setElements:(double *)values; - (void)getElements:(double *)values; - (double)x; - (void)setX:(double)x; - (double)y; - (void)setX:(double)y; - (void)setValuesWithTuple:(G3DTuple2d *)aTuple; - (NSString *)description; //----------------------------------------------------------------------------- // NSCoding //----------------------------------------------------------------------------- - (void)encodeWithCoder:(NSCoder *)aCoder; - (id)initWithCoder:(NSCoder *)aCoder; //----------------------------------------------------------------------------- // NSCopying //----------------------------------------------------------------------------- - (id)copyWithZone:(NSZone *)zone; @end extern NSString *G3DTuple2dException; #endif