Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOJoystickSplineSegment Class Reference
+ Inheritance diagram for OOJoystickSplineSegment:
+ Collaboration diagram for OOJoystickSplineSegment:

Instance Methods

(id) - init
 
(id) - initWithData:right:
 
(id) - initWithData:right:gradientleft:
 
(id) - initWithData:right:gradientright:
 
(id) - initWithData:right:gradientleft:gradientright:
 
(id) - copyWithZone:
 
(double) - start
 
(double) - end
 
(double) - value:
 
(double) - gradient:
 

Class Methods

(id) + segmentWithData:right:
 
(id) + segmentWithData:right:gradientleft:
 
(id) + segmentWithData:right:gradientright:
 
(id) + segmentWithData:right:gradientleft:gradientright:
 

Private Attributes

double start
 
double end
 
double a [4]
 

Detailed Description

Definition at line 33 of file OOJoystickProfile.m.

Method Documentation

◆ copyWithZone:

- (id) copyWithZone: (NSZone *) zone

Definition at line 39 of file OOJoystickProfile.m.

211{
212 OOJoystickSplineSegment *copy = [[OOJoystickSplineSegment allocWithZone: zone] init];
213 copy->start = start;
214 copy->end = end;
215 copy->a[0] = a[0];
216 copy->a[1] = a[1];
217 copy->a[2] = a[2];
218 copy->a[3] = a[3];
219 return copy;
220}
221

◆ end

- (double) end

◆ gradient:

- (double) gradient: (double) t

Definition at line 39 of file OOJoystickProfile.m.

341{
342 return a[1]+(2*a[2] + 3*a[3]*x)*x;
343}
344
float x

◆ init

- (id) init

Definition at line 39 of file OOJoystickProfile.m.

197{
198 if ((self = [super init]))
199 {
200 start = 0.0;
201 end = 1.0;
202 a[0] = 0.0;
203 a[1] = 1.0;
204 a[2] = 0.0;
205 a[3] = 0.0;
206 }
207 return self;
208}
209

◆ initWithData:right:

- (id) initWithData: (NSPoint) left
right: (NSPoint) right 

Definition at line 39 of file OOJoystickProfile.m.

223{
224 double dx = right.x - left.x;
225 if (dx <= 0.0)
226 {
227 return nil;
228 }
229 if ((self = [super init]))
230 {
231 start = left.x;
232 end = right.x;
233 a[1] = (right.y - left.y)/dx;
234 a[0] = left.y-a[1]*left.x;
235 a[2] = 0.0;
236 a[3] = 0.0;
237 }
238 return self;
239}
240
return nil
float y

◆ initWithData:right:gradientleft:

- (id) initWithData: (NSPoint) left
right: (NSPoint) right
gradientleft: (double) gradientleft 

Definition at line 39 of file OOJoystickProfile.m.

242{
243 double dx = right.x - left.x;
244 if (dx <= 0.0)
245 {
246 return nil;
247 }
248 if ((self = [super init]))
249 {
250 start = left.x;
251 end = right.x;
252 a[0] = left.y*right.x*(right.x - 2*left.x)/(dx*dx) + right.y*left.x*left.x/(dx*dx) - gradientleft*left.x*right.x/dx;
253 a[1] = 2*left.x*(left.y-right.y)/(dx*dx) + gradientleft*(left.x+right.x)/dx;
254 a[2] = (right.y-left.y)/(dx*dx) - gradientleft/dx;
255 }
256 return self;
257}
258

◆ initWithData:right:gradientleft:gradientright:

- (id) initWithData: (NSPoint) left
right: (NSPoint) right
gradientleft: (double) gradientleft
gradientright: (double) gradientright 

Definition at line 39 of file OOJoystickProfile.m.

278{
279 double dx = right.x - left.x;
280 if (dx <= 0.0)
281 {
282 return nil;
283 }
284 if ((self = [super init]))
285 {
286 start = left.x;
287 end = right.x;
288 a[0] = (left.y*right.x*right.x*(right.x-3*left.x) - right.y*left.x*left.x*(left.x-3*right.x))/(dx*dx*dx) - (gradientleft*right.x + gradientright*left.x)*left.x*right.x/(dx*dx);
289 a[1] = 6*left.x*right.x*(left.y-right.y)/(dx*dx*dx) + (gradientleft*right.x*(right.x+2*left.x) + gradientright*left.x*(left.x+2*right.x))/(dx*dx);
290 a[2] = 3*(left.x+right.x)*(right.y-left.y)/(dx*dx*dx) - (gradientleft*(2*right.x+left.x)+gradientright*(2*left.x+right.x))/(dx*dx);
291 a[3] = 2*(left.y-right.y)/(dx*dx*dx) + (gradientleft+gradientright)/(dx*dx);
292 }
293 return self;
294}
295

◆ initWithData:right:gradientright:

- (id) initWithData: (NSPoint) left
right: (NSPoint) right
gradientright: (double) gradientright 

Definition at line 39 of file OOJoystickProfile.m.

260{
261 double dx = right.x - left.x;
262 if (dx <= 0.0)
263 {
264 return nil;
265 }
266 if ((self = [super init]))
267 {
268 start = left.x;
269 end = right.x;
270 a[0] = (left.y*right.x*right.x + right.y*left.x*(left.x-2*right.x))/(dx*dx) + gradientright*left.x*right.x/dx;
271 a[1] = 2*right.x*(right.y-left.y)/(dx*dx) - gradientright*(left.x+right.x)/dx;
272 a[2] = (left.y-right.y)/(dx*dx) + gradientright/dx;
273 }
274 return self;
275}
276

◆ segmentWithData:right:

+ (id) segmentWithData: (NSPoint) left
right: (NSPoint) right 

Definition at line 39 of file OOJoystickProfile.m.

297{
298 OOJoystickSplineSegment *segment = [[OOJoystickSplineSegment alloc] initWithData: left right:right];
299 return [segment autorelease];
300}
301

◆ segmentWithData:right:gradientleft:

+ (id) segmentWithData: (NSPoint) left
right: (NSPoint) right
gradientleft: (double) gradientleft 

Definition at line 39 of file OOJoystickProfile.m.

304{
305 OOJoystickSplineSegment *segment = [[OOJoystickSplineSegment alloc] initWithData: left right:right gradientleft:gradientleft];
306 return [segment autorelease];
307}
308

◆ segmentWithData:right:gradientleft:gradientright:

+ (id) segmentWithData: (NSPoint) left
right: (NSPoint) right
gradientleft: (double) gradientleft
gradientright: (double) gradientright 

Definition at line 39 of file OOJoystickProfile.m.

318{
319 OOJoystickSplineSegment *segment = [[OOJoystickSplineSegment alloc] initWithData: left right:right gradientleft:gradientleft gradientright:gradientright];
320 return [segment autorelease];
321}
322

◆ segmentWithData:right:gradientright:

+ (id) segmentWithData: (NSPoint) left
right: (NSPoint) right
gradientright: (double) gradientright 

Definition at line 39 of file OOJoystickProfile.m.

311{
312 OOJoystickSplineSegment *segment = [[OOJoystickSplineSegment alloc] initWithData: left right:right gradientright:gradientright];
313 return [segment autorelease];
314}
315

◆ start

- (double) start

◆ value:

- (double) value: (double) t

Definition at line 39 of file OOJoystickProfile.m.

336{
337 return a[0] + (a[1] + (a[2] + a[3]*x)*x)*x;
338}
339

Member Data Documentation

◆ a

- (double a[4])
private

Definition at line 39 of file OOJoystickProfile.m.

◆ end

- (double) end
private

Definition at line 38 of file OOJoystickProfile.m.

◆ start

- (double) start
private

Definition at line 37 of file OOJoystickProfile.m.


The documentation for this class was generated from the following file: