Updated Mac version to compile with Eigen conversion.
parent
80d0e02d3b
commit
198df1561d
|
@ -15,9 +15,11 @@
|
|||
|
||||
@interface Astro : NSObject
|
||||
+(NSString*)stringWithCoordinateSystem:(NSNumber*)n;
|
||||
/*
|
||||
+(CelestiaVector*)equatorialToCelestialCart:(NSNumber*)ra declination:(NSNumber*)dec distance:(NSNumber*)distance;
|
||||
+(CelestiaUniversalCoord*)universalPosition:(CelestiaVector*)heliocentric starPosition:(CelestiaVector*)starPosition;
|
||||
+(CelestiaVector*)heliocentricPosition:(CelestiaUniversalCoord*)universal starPosition:(CelestiaVector*)starPosition;
|
||||
*/
|
||||
+(NSNumber*)sphereIlluminationFraction:(CelestiaVector*)spherePos viewerPosition:(CelestiaVector*)viewerPos;
|
||||
+(NSNumber*)coordinateSystem:(NSString*)coord;
|
||||
+(NSNumber*)julianDate:(NSDate*)date;
|
||||
|
|
|
@ -82,6 +82,8 @@ NSDictionary* coordinateDict;
|
|||
[spherePos point3d],
|
||||
[viewerPos point3d])];
|
||||
}
|
||||
|
||||
/*
|
||||
+(CelestiaVector*)heliocentricPosition:(CelestiaUniversalCoord*)universal starPosition:(CelestiaVector*)starPosition
|
||||
{
|
||||
return [CelestiaVector vectorWithPoint3d:astro::heliocentricPosition([universal universalCoord], [starPosition point3f])];
|
||||
|
@ -94,6 +96,8 @@ NSDictionary* coordinateDict;
|
|||
{
|
||||
return [CelestiaVector vectorWithPoint3d:astro::equatorialToCelestialCart([ra doubleValue], [dec doubleValue], [distance doubleValue])];
|
||||
}
|
||||
*/
|
||||
|
||||
+(NSNumber*)coordinateSystem:(NSString*)coord
|
||||
{
|
||||
return [coordinateDict objectForKey:coord];
|
||||
|
|
|
@ -16,14 +16,18 @@
|
|||
-(NSNumber*)radius;
|
||||
-(NSNumber*)mass;
|
||||
-(NSNumber*)albedo;
|
||||
-(CelestiaVector*)orientation;
|
||||
-(void)setOrientation:(CelestiaVector*)q;
|
||||
/*
|
||||
-(CelestiaVector*)geometryOrientation;
|
||||
-(void)setGeometryOrientation:(CelestiaVector*)q;
|
||||
*/
|
||||
-(void)setName:(NSString*)s;
|
||||
-(void)setMass:(NSNumber*)m;
|
||||
-(void)setAlbedo:(NSNumber*)a;
|
||||
/*
|
||||
-(CelestiaVector*)astrocentricPosition:(NSNumber*)n;
|
||||
-(CelestiaVector*)equatorialToBodyFixed:(NSNumber*)n;
|
||||
-(CelestiaVector*)eclipticToEquatorial:(NSNumber*)n;
|
||||
-(CelestiaVector*)eclipticToBodyFixed:(NSNumber*)n;
|
||||
*/
|
||||
-(NSArray*)alternateSurfaceNames;
|
||||
@end
|
||||
|
|
|
@ -75,14 +75,16 @@
|
|||
{
|
||||
return [NSNumber numberWithFloat:[self body]->getAlbedo()];
|
||||
}
|
||||
-(CelestiaVector*)orientation
|
||||
/*
|
||||
-(CelestiaVector*)geometryOrientation
|
||||
{
|
||||
return [CelestiaVector vectorWithQuatf:[self body]->getOrientation()];
|
||||
return [CelestiaVector vectorWithQuatf:[self body]->getGeometryOrientation()];
|
||||
}
|
||||
-(void)setOrientation:(CelestiaVector*)q
|
||||
-(void)setGeometryOrientation:(CelestiaVector*)q
|
||||
{
|
||||
[self body]->setOrientation([q quatf]);
|
||||
[self body]->setGeometryOrientation([q quatf]);
|
||||
}
|
||||
*/
|
||||
-(void)setName:(NSString*)s
|
||||
{
|
||||
// Body::setName method is now private
|
||||
|
@ -96,6 +98,7 @@
|
|||
{
|
||||
[self body]->setAlbedo([a floatValue]);
|
||||
}
|
||||
/*
|
||||
-(CelestiaVector*)astrocentricPosition:(NSNumber*)n
|
||||
{
|
||||
return [CelestiaVector vectorWithPoint3d:[self body]->getAstrocentricPosition([n doubleValue])];
|
||||
|
@ -112,7 +115,7 @@
|
|||
{
|
||||
return [CelestiaVector vectorWithQuatd:[self body]->getEclipticToBodyFixed([n doubleValue])];
|
||||
}
|
||||
|
||||
*/
|
||||
-(NSArray*)alternateSurfaceNames
|
||||
{
|
||||
NSMutableArray *result = nil;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#import "CelestiaSimulation.h"
|
||||
#import "CelestiaSimulation_PrivateAPI.h"
|
||||
|
||||
#include <celengine/eigenport.h>
|
||||
|
||||
#ifdef URL_FAVORITES
|
||||
#include "url.h"
|
||||
#endif
|
||||
|
@ -135,7 +137,7 @@
|
|||
name = [[[[CelestiaAppCore sharedAppCore] simulation] julianDate] description];
|
||||
fav->jd = sim->getTime();
|
||||
fav->position = sim->getObserver().getPosition();
|
||||
fav->orientation = sim->getObserver().getOrientationf();
|
||||
fav->orientation = fromEigen(sim->getObserver().getOrientationf());
|
||||
fav->name = [name stdString];
|
||||
fav->isFolder = false;
|
||||
fav->parentFolder = [parentFolder stdString];
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
-(NSString*)type;
|
||||
//-(void)setType:(NSString*)s;
|
||||
-(NSString *)name;
|
||||
/*
|
||||
-(CelestiaVector*)orientation;
|
||||
-(void)setOrientation:(CelestiaVector*)q;
|
||||
-(CelestiaVector*)position;
|
||||
-(void)setPosition:(CelestiaVector*)q;
|
||||
*/
|
||||
//-(void)setName:(NSString*)s;
|
||||
-(NSNumber *)radius;
|
||||
-(void)setRadius:(NSNumber*)r;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
{
|
||||
return [NSString stringWithStdString:[[CelestiaAppCore sharedAppCore] appCore]->getSimulation()->getUniverse()->getDSOCatalog()->getDSOName([self galaxy])];
|
||||
}
|
||||
/*
|
||||
-(CelestiaVector*)orientation
|
||||
{
|
||||
return [CelestiaVector vectorWithQuatf:[self galaxy]->getOrientation()];
|
||||
|
@ -71,6 +72,7 @@
|
|||
{
|
||||
[self galaxy]->setPosition([q point3d]);
|
||||
}
|
||||
*/
|
||||
//-(void)setName:(NSString*)s
|
||||
//{
|
||||
// [self galaxy]->setName([s stdString]);
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
}
|
||||
|
||||
-(CelestiaUniversalCoord*)position;
|
||||
/*
|
||||
-(CelestiaVector*)orientation;
|
||||
-(void)setOrientation:(CelestiaVector*)q;
|
||||
-(CelestiaVector*)velocity;
|
||||
-(void)setVelocity:(CelestiaVector*)v;
|
||||
-(CelestiaVector*)angularVelocity;
|
||||
-(void)setAngularVelocity:(CelestiaVector*)v;
|
||||
*/
|
||||
-(void)setPosition:(CelestiaUniversalCoord*)p;
|
||||
-(void)setPositionWithPoint:(CelestiaVector*)p;
|
||||
-(void)update:(NSNumber*)dt timeScale: (NSNumber*)ts;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
{
|
||||
return [[[CelestiaUniversalCoord alloc] initWithUniversalCoord:[self observer].getPosition()] autorelease];
|
||||
}
|
||||
/*
|
||||
-(CelestiaVector*)orientation
|
||||
{
|
||||
return [CelestiaVector vectorWithQuatf:[self observer].getOrientationf()];
|
||||
|
@ -61,6 +62,7 @@
|
|||
{
|
||||
[self observer].setAngularVelocity([v vec3d]);
|
||||
}
|
||||
*/
|
||||
-(void)setPosition:(CelestiaUniversalCoord*)p
|
||||
{
|
||||
[self observer].setPosition([p universalCoord]);
|
||||
|
|
|
@ -71,10 +71,12 @@ FrameOfReference getFrame() const;
|
|||
{
|
||||
[self simulation]->update([dt doubleValue]);
|
||||
}
|
||||
/*
|
||||
-(CelestiaSelection*)pickObject:(CelestiaVector*)pickRay tolerance:(NSNumber*)tolerance
|
||||
{
|
||||
return [[[CelestiaSelection alloc] initWithSelection:[self simulation]->pickObject([pickRay vec3f],[tolerance floatValue])] autorelease];
|
||||
}
|
||||
*/
|
||||
-(CelestiaSelection*)pickObject:(CelestiaVector*)pickRay
|
||||
{
|
||||
return [self pickObject:pickRay tolerance:[NSNumber numberWithDouble:0.0]];
|
||||
|
@ -87,6 +89,7 @@ FrameOfReference getFrame() const;
|
|||
return [[[CelestiaUniverse alloc] initWithUniverse:uni] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
-(void)orbit:(CelestiaVector*)q
|
||||
{
|
||||
[self simulation]->orbit([q quatf]);
|
||||
|
@ -95,6 +98,7 @@ FrameOfReference getFrame() const;
|
|||
{
|
||||
[self simulation]->rotate([q quatf]);
|
||||
}
|
||||
*/
|
||||
-(void)changeOrbitDistance:(NSNumber*)d
|
||||
{
|
||||
[self simulation]->changeOrbitDistance([d floatValue]);
|
||||
|
@ -139,6 +143,7 @@ FrameOfReference getFrame() const;
|
|||
return [[[CelestiaSelection alloc] initWithSelection:[self simulation]->findObjectFromPath([s stdString], true)] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
-(void)gotoSelection:(NSNumber*)gotoTime up:(CelestiaVector*)up coordinateSystem:(NSString*)csysName
|
||||
{
|
||||
[self simulation]->gotoSelection(
|
||||
|
@ -166,6 +171,7 @@ FrameOfReference getFrame() const;
|
|||
[latitude floatValue],
|
||||
[up vec3f]);
|
||||
}
|
||||
*/
|
||||
|
||||
-(NSArray*)getSelectionLongLat
|
||||
{
|
||||
|
@ -212,7 +218,7 @@ FrameOfReference getFrame() const;
|
|||
}
|
||||
-(void)setObserverOrientation:(CelestiaVector*)q
|
||||
{
|
||||
[self simulation]->setObserverOrientation([q quatf]);
|
||||
[self simulation]->setObserverOrientation([q quaternionf]);
|
||||
}
|
||||
-(void)setObserverMode:(NSString*)m
|
||||
{
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
-(void)setCatalogNumber:(NSNumber*)cat;
|
||||
-(void)setCatalogNumber:(NSNumber*)cat atIndex:(NSNumber*)index;
|
||||
-(NSNumber *)radius;
|
||||
/*
|
||||
-(CelestiaVector*)position;
|
||||
-(void)setPosition:(CelestiaVector*)p;
|
||||
*/
|
||||
-(NSNumber*)apparentMagnitude:(NSNumber*)m;
|
||||
-(NSNumber*)luminosity;
|
||||
-(NSNumber*)temperature;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
{
|
||||
return [NSNumber numberWithFloat:[self star]->getRadius()];
|
||||
}
|
||||
/*
|
||||
-(CelestiaVector*)position
|
||||
{
|
||||
return [CelestiaVector vectorWithPoint3f:[self star]->getPosition()];
|
||||
|
@ -67,6 +68,7 @@
|
|||
{
|
||||
[self star]->setPosition([p point3f]);
|
||||
}
|
||||
*/
|
||||
-(NSNumber*)apparentMagnitude:(NSNumber*)m
|
||||
{
|
||||
return [NSNumber numberWithFloat:[self star]->getApparentMagnitude([m floatValue])];
|
||||
|
|
|
@ -10,6 +10,62 @@
|
|||
#import "CelestiaVector_PrivateAPI.h"
|
||||
|
||||
@implementation CelestiaVector(PrivateAPI)
|
||||
|
||||
/*** Conversions to and from Eigen structures ***/
|
||||
|
||||
+(CelestiaVector*)vectorWithVector3f:(const Eigen::Vector3f&)v
|
||||
{
|
||||
return [CelestiaVector vectorWithx:[NSNumber numberWithFloat:v.x()] y:[NSNumber numberWithFloat:v.y()] z:[NSNumber numberWithFloat:v.z()]];
|
||||
}
|
||||
|
||||
+(CelestiaVector*)vectorWithVector3d:(const Eigen::Vector3d&)v
|
||||
{
|
||||
return [CelestiaVector vectorWithx:[NSNumber numberWithDouble:v.x()] y:[NSNumber numberWithDouble:v.y()] z:[NSNumber numberWithDouble:v.z()]];
|
||||
}
|
||||
|
||||
+(CelestiaVector*)vectorWithQuaternionf:(const Eigen::Quaternionf&)v
|
||||
{
|
||||
return [CelestiaVector vectorWithx:[NSNumber numberWithFloat:v.x()] y:[NSNumber numberWithFloat:v.y()] z:[NSNumber numberWithFloat:v.z()] w:[NSNumber numberWithFloat:v.w()]];
|
||||
}
|
||||
|
||||
+(CelestiaVector*)vectorWithQuaterniond:(const Eigen::Quaterniond&)v
|
||||
{
|
||||
return [CelestiaVector vectorWithx:[NSNumber numberWithDouble:v.x()] y:[NSNumber numberWithDouble:v.y()] z:[NSNumber numberWithDouble:v.z()] w:[NSNumber numberWithDouble:v.w()]];
|
||||
}
|
||||
|
||||
-(CelestiaVector*)initWithVector3f:(const Eigen::Vector3f&)v
|
||||
{
|
||||
return [self initWithx:[NSNumber numberWithFloat:v.x()] y:[NSNumber numberWithFloat:v.y()] z:[NSNumber numberWithFloat:v.z()]];
|
||||
}
|
||||
|
||||
-(CelestiaVector*)initWithVector3d:(const Eigen::Vector3d&)v
|
||||
{
|
||||
return [self initWithx:[NSNumber numberWithDouble:v.x()] y:[NSNumber numberWithDouble:v.y()] z:[NSNumber numberWithDouble:v.z()]];
|
||||
}
|
||||
|
||||
-(Eigen::Vector3f)vector3f
|
||||
{
|
||||
return Eigen::Vector3f([[self x] floatValue],[[self y] floatValue],[[self z] floatValue]);
|
||||
}
|
||||
|
||||
-(Eigen::Vector3d)vector3d
|
||||
{
|
||||
return Eigen::Vector3d([[self x] doubleValue],[[self y] doubleValue],[[self z] doubleValue]);
|
||||
}
|
||||
|
||||
-(Eigen::Quaternionf)quaternionf
|
||||
{
|
||||
return Eigen::Quaternionf([[self w] floatValue],[[self x] floatValue],[[self y] floatValue],[[self z] floatValue]);
|
||||
}
|
||||
|
||||
-(Eigen::Quaterniond)quaterniond
|
||||
{
|
||||
return Eigen::Quaterniond([[self w] doubleValue],[[self x] doubleValue],[[self y] doubleValue],[[self z] doubleValue]);
|
||||
}
|
||||
|
||||
/*** End Eigen conversions ***/
|
||||
|
||||
|
||||
+(CelestiaVector*)vectorWithVec2f:(Vec2f)v
|
||||
{
|
||||
return [CelestiaVector vectorWithx:[NSNumber numberWithFloat:v.x] y:[NSNumber numberWithFloat:v.y]];
|
||||
|
|
|
@ -9,7 +9,21 @@
|
|||
|
||||
#include <celmath/vecmath.h>
|
||||
#include <celmath/quaternion.h>
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
@interface CelestiaVector(PrivateAPI)
|
||||
+(CelestiaVector*)vectorWithVector3f:(const Eigen::Vector3f&)v;
|
||||
+(CelestiaVector*)vectorWithVector3d:(const Eigen::Vector3d&)v;
|
||||
+(CelestiaVector*)vectorWithQuaternionf:(const Eigen::Quaternionf&)v;
|
||||
+(CelestiaVector*)vectorWithQuaterniond:(const Eigen::Quaterniond&)v;
|
||||
-(CelestiaVector*)initWithVector3f:(const Eigen::Vector3f&)v;
|
||||
-(CelestiaVector*)initWithVector3d:(const Eigen::Vector3d&)v;
|
||||
-(Eigen::Vector3f)vector3f;
|
||||
-(Eigen::Vector3d)vector3d;
|
||||
-(Eigen::Quaternionf)quaternionf;
|
||||
-(Eigen::Quaterniond)quaterniond;
|
||||
|
||||
+(CelestiaVector*)vectorWithVec2f:(Vec2f)v;
|
||||
+(CelestiaVector*)vectorWithVec3f:(Vec3f)v;
|
||||
+(CelestiaVector*)vectorWithVec4f:(Vec4f)v;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#import "NSString_ObjCPlusPlus.h"
|
||||
#import "CelestiaBody_PrivateAPI.h"
|
||||
#import "eclipsefinder.h"
|
||||
#import <celmath/geomutil.h>
|
||||
|
||||
@interface EclipseFinderController(Private)
|
||||
- (void)getEclipses: (id)aObject;
|
||||
|
@ -173,10 +174,10 @@ static CelestiaBody *eclipseBody;
|
|||
sim->setFrame(ObserverFrame::PhaseLock, target, ref);
|
||||
sim->update(0.0);
|
||||
|
||||
double distance = astro::kilometersToMicroLightYears(target.radius() * 4.0);
|
||||
double distance = target.radius() * 4.0;
|
||||
sim->setSelection(target);
|
||||
sim->gotoLocation(Point3d(distance, 0, 0),
|
||||
Quatd::yrotation(-0.5*PI)*Quatd::xrotation(-0.5*PI),
|
||||
sim->gotoLocation(UniversalCoord::Zero().offsetKm(Eigen::Vector3d(distance, 0, 0)),
|
||||
YRotation(-0.5*PI)*XRotation(-0.5*PI),
|
||||
5.0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue