Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[apple scitech] Accelerated Cartesian Vector Struct



Hello all,

I am having another 'try the accelerate framework' desire/bug today. This happens every so often. However, I normally give up because I can't find any example code that is simple enough for be to follow (I find the learning curve a bit steep). Can anybody here help me apply the accelerate framework to the simple example below. It is a Cartesian vector struct with one operation which finds the length of the vector.

Regards,

Daniel.

/*
	NON-ACCELERATED EXAMPLE

	A Cartesian vector structure and convenience make function.
	Let's also add a simple function to calculate the length
	of the vector.
*/
typedef struct _Vector
{
	float i;
	float j;
	float k;
} Vector;


Vector MakeVector (float i, float j, float k) { Vector v; v.i = i; v.j = j; v.k = k; return v; }

float VectorLength(Vector *v)
{
	return sqrt(v->i*v->i + v->j*v->j + v->k*v->k);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Scitech mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/scitech/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.