//----------------------------------------------------------------------------- // Project GeometryKit // Class G3DTuple4f // 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: G3DTuple4f.h,v 1.5 2001/01/05 20:50:49 robert Exp $ //----------------------------------------------------------------------------- #ifndef __G3DTuple4f_h_INCLUDE #define __G3DTuple4f_h_INCLUDE #import @interface G3DTuple4f : NSObject { float tuple[4]; } //----------------------------------------------------------------------------- // Class methods //----------------------------------------------------------------------------- + (void)initialize; + (G3DTuple4f *)tuple4f; + (G3DTuple4f *)tuple4fWithElements:(float *)vals; + (G3DTuple4f *)tuple4fWithX:(float)x y:(float)y z:(float)z w:(float)w; + (G3DTuple4f *)tuple4fWithTuple4f:(G3DTuple4f *)aTuple; //----------------------------------------------------------------------------- // init and free //----------------------------------------------------------------------------- - (id)init; // Initialises a new tuple with the values 0.0,0.0,0.0,0.0 - (id)initWithElements:(float *)vals; - (id)initWithX:(float)x y:(float)y z:(float)z w:(float)w; // Designated initialiser - (id)initWithTuple:(G3DTuple4f *)aTuple; // Initialises a new tuple by invoking initWithElements //----------------------------------------------------------------------------- // Math //----------------------------------------------------------------------------- - (void)absolute; - (void)clamp; - (void)clampLow:(float)low high:(float)high; - (void)addTuple4f:(G3DTuple4f *)aTuple; - (void)subTuple4f:(G3DTuple4f *)aTuple; - (void)multiplyBy:(float)aScalar; - (void)divideBy:(float)aScalar; - (void)interpolateBetween:(G3DTuple4f *)first and:(G3DTuple4f *)second factor:(float)factor; // (1-factor)*first + factor*second - (void)negate; - (BOOL)isEqualToTuple:(id)anObj; //----------------------------------------------------------------------------- // Accessing //----------------------------------------------------------------------------- - (float *)elements; - (void)setElements:(float *)values; - (void)getElements:(float *)values; - (float)x; - (void)setX:(float)x; - (float)y; - (void)setY:(float)y; - (float)z; - (void)setZ:(float)z; - (float)w; - (void)setW:(float)w; - (void)setValuesWithTuple:(G3DTuple4f *)aTuple; - (NSString *)description; //----------------------------------------------------------------------------- // NSCoding //----------------------------------------------------------------------------- - (void)encodeWithCoder:(NSCoder *)aCoder; - (id)initWithCoder:(NSCoder *)aCoder; //----------------------------------------------------------------------------- // NSCopying //----------------------------------------------------------------------------- - (id)copyWithZone:(NSZone *)zone; @end extern NSString *G3DTuple4fException; #endif