RSS

(root)/iphone/common : 66 : source/geometry.h

To get this branch, use:
bzr branch /browse/iphone/common

« back to all changes in this revision

Viewing changes to source/geometry.h

Dömötör Gulyás
2010-07-07 13:18:11
Revision ID: dognotdog@gmail.com-20100707111811-v0bkv813ukxe2d7d
adds gfx.h/m from RemoteDriver; extends geometry.h with size scaling, point lerp and rotation

Show diffs side-by-side

added added

removed removed

381
381
        return CGPointMake(a.x*b, a.y*b);
382
382
}
383
383
 
 
384
static inline CGSize CGSizeScale(CGSize a, float b)
 
385
{
 
386
        return CGSizeMake(a.width*b, a.height*b);
 
387
}
 
388
 
384
389
static inline float CGPointDoubleDot(CGPoint a)
385
390
{
386
391
        return a.x*a.x+a.y*a.y;
427
432
        return CGPointScale(b, CGPointDot(a,a)/CGPointDot(a,b));
428
433
}
429
434
 
 
435
static inline CGPoint CGPointLerp(CGPoint a, CGPoint b, float t)
 
436
{
 
437
        return CGPointAdd(a, CGPointScale(CGPointSub(b, a), t));
 
438
}
 
439
 
 
440
 
 
441
static inline CGPoint CGPointRotate(CGPoint a, float w)
 
442
{
 
443
        CGPoint cross = CGPointMake(a.y,-a.x);
 
444
 
 
445
        float cosa = cosf(w), sina = sin(w);
 
446
        
 
447
        CGPoint r;
 
448
 
 
449
        r.x = a.x*cosa + cross.x*sina;
 
450
        r.y = a.y*cosa + cross.y*sina;
 
451
 
 
452
        return r;
 
453
        
 
454
}
 
455
 
430
456
 
431
457
static inline long CGLineSegmentsIntersect2(CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3)
432
458
{

Loggerhead 1.17 is a web-based interface for Bazaar branches