Legacy foo_actions can now have local variables, which are cleared when the _actions completes. Marked DebugConsole.py executable for unices. Fixed bugs in vector randomization code, and added a third randomizer which provides an even distribution of lengths (but uneven distribution in space).

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1420 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2008-02-25 16:22:15 +00:00
parent 9c70bad9cf
commit cc056a6a75
14 changed files with 173 additions and 18 deletions

View File

@ -26,7 +26,7 @@ endif
OBJC_PROGRAM_NAME = oolite
oolite_C_FILES = legacy_random.c strlcpy.c OOTCPStreamDecoder.c
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntityLegacyScriptEngine.m PlayerEntityContracts.m PlayerEntityControls.m PlayerEntityLoadSave.m PlayerEntitySound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntityAI.m ShipEntity.m SkyEntity.m StationEntity.m Universe.m OOSound.m SDLMusic.m NSFileManagerOOExtensions.m JoystickHandler.m PlayerEntityStickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m NSScannerOOExtensions.m OOXMLExtensions.m NSMutableDictionaryOOExtensions.m Geometry.m Octree.m CollisionRegion.m OOColor.m OOLogging.m OOCacheManager.m OOCache.m OOStringParsing.m OOCollectionExtractors.m OOVector.m OOMatrix.m OOQuaternion.m OOVoxel.m OOTriangle.m OOPListParsing.m OOFastArithmetic.m OOTextureScaling.m OOConstToString.m OOScript.m OOJSScript.m OOJavaScriptEngine.m OOPListScript.m NSStringOOExtensions.m PlayerEntityScriptMethods.m OOWeakReference.m OOJSEntity.m EntityOOJavaScriptExtensions.m OOJSQuaternion.m OOMaterial.m OOShaderMaterial.m OOShaderProgram.m OOShaderUniform.m OOTexture.m OOTextureLoader.m OOPNGTextureLoader.m OOOpenGLExtensionManager.m OOBasicMaterial.m OOSingleTextureMaterial.m OOCPUInfo.m OOSelfDrawingEntity.m OOEntityWithDrawable.m OODrawable.m OOJSVector.m OOMesh.m OOOpenGL.m OOGraphicsResetManager.m OOProbabilisticTextureManager.m OODebugGLDrawing.m OOShaderUniformMethodType.m OOAsyncQueue.m TextureStore.m OOOXPVerifier.m OOOXPVerifierStage.m OOFileScannerVerifierStage.m OOCheckRequiresPListVerifierStage.m OOCheckDemoShipsPListVerifierStage.m OOCheckEquipmentPListVerifierStage.m OOTextureVerifierStage.m OOModelVerifierStage.m OOCheckShipDataPListVerifierStage.m OOPListSchemaVerifier.m OOJSShip.m OOJSPlayer.m OOJSCall.m OOJSStation.m OOJSSystem.m OOLegacyEventHandlerScript.m OOJSOolite.m OORoleSet.m OOJSGlobal.m OOJSMissionVariables.m OOJSMission.m OOPriorityQueue.m OOScriptTimer.m OOJSTimer.m OOJSClock.m OODebugSupport.m OODebugMonitor.m OOJSConsole.m OODebugTCPConsoleClient.m OOTCPStreamDecoderAbstractionLayer.m OOEntityFilterPredicate.m OOJSPlanet.m OOJSWorldScripts.m OOJSSun.m NSThreadOOExtensions.m OOEncodingConverter.m OOJSSound.m OOJSSoundSource.m OOMusicController.m OOLogHeader.m OOJSSpecialFunctions.m
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntityLegacyScriptEngine.m PlayerEntityContracts.m PlayerEntityControls.m PlayerEntityLoadSave.m PlayerEntitySound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntityAI.m ShipEntity.m SkyEntity.m StationEntity.m Universe.m OOSound.m SDLMusic.m NSFileManagerOOExtensions.m JoystickHandler.m PlayerEntityStickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m NSScannerOOExtensions.m OOXMLExtensions.m NSMutableDictionaryOOExtensions.m Geometry.m Octree.m CollisionRegion.m OOColor.m OOLogging.m OOCacheManager.m OOCache.m OOStringParsing.m OOCollectionExtractors.m OOVector.m OOMatrix.m OOQuaternion.m OOVoxel.m OOTriangle.m OOPListParsing.m OOFastArithmetic.m OOTextureScaling.m OOConstToString.m OOScript.m OOJSScript.m OOJavaScriptEngine.m OOPListScript.m NSStringOOExtensions.m PlayerEntityScriptMethods.m OOWeakReference.m OOJSEntity.m EntityOOJavaScriptExtensions.m OOJSQuaternion.m OOMaterial.m OOShaderMaterial.m OOShaderProgram.m OOShaderUniform.m OOTexture.m OOTextureLoader.m OOPNGTextureLoader.m OOOpenGLExtensionManager.m OOBasicMaterial.m OOSingleTextureMaterial.m OOCPUInfo.m OOSelfDrawingEntity.m OOEntityWithDrawable.m OODrawable.m OOJSVector.m OOMesh.m OOOpenGL.m OOGraphicsResetManager.m OOProbabilisticTextureManager.m OODebugGLDrawing.m OOShaderUniformMethodType.m OOAsyncQueue.m TextureStore.m OOOXPVerifier.m OOOXPVerifierStage.m OOFileScannerVerifierStage.m OOCheckRequiresPListVerifierStage.m OOCheckDemoShipsPListVerifierStage.m OOCheckEquipmentPListVerifierStage.m OOTextureVerifierStage.m OOModelVerifierStage.m OOCheckShipDataPListVerifierStage.m OOPListSchemaVerifier.m OOJSShip.m OOJSPlayer.m OOJSCall.m OOJSStation.m OOJSSystem.m OOLegacyEventHandlerScript.m OOJSOolite.m OORoleSet.m OOJSGlobal.m OOJSMissionVariables.m OOJSMission.m OOPriorityQueue.m OOScriptTimer.m OOJSTimer.m OOJSClock.m OODebugSupport.m OODebugMonitor.m OOJSConsole.m OODebugTCPConsoleClient.m OOTCPStreamDecoderAbstractionLayer.m OOEntityFilterPredicate.m OOJSPlanet.m OOJSWorldScripts.m OOJSSun.m NSThreadOOExtensions.m OOEncodingConverter.m OOJSSound.m OOJSSoundSource.m OOMusicController.m OOLogHeader.m OOJSSpecialFunctions.m OOSpacialReference.m
include $(GNUSTEP_MAKEFILES)/objc.make
include GNUmakefile.postamble

View File

@ -368,6 +368,8 @@
1A4FB3350C8DC86800DC8E1F /* OOJSOolite.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4FB3330C8DC86800DC8E1F /* OOJSOolite.h */; };
1A4FB3360C8DC86800DC8E1F /* OOJSOolite.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A4FB3340C8DC86800DC8E1F /* OOJSOolite.m */; };
1A4FB4BA0C8E11D800DC8E1F /* libjs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A4FB2380C8D6A7500DC8E1F /* libjs.a */; };
1A5218DA0D72EC21000865E9 /* OOSpatialReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5218D80D72EC21000865E9 /* OOSpatialReference.h */; };
1A5218DE0D72ECE5000865E9 /* OOSpatialReference.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A5218DD0D72ECE5000865E9 /* OOSpatialReference.m */; };
1A5AA3230C0098AF0029C78A /* OOOpenGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A5AA3220C0098AF0029C78A /* OOOpenGL.m */; };
1A5DB1EA0BBD8F0000D57389 /* OOConstToString.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5DB1E80BBD8F0000D57389 /* OOConstToString.h */; };
1A5DB1EB0BBD8F0000D57389 /* OOConstToString.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A5DB1E90BBD8F0000D57389 /* OOConstToString.m */; };
@ -1342,6 +1344,8 @@
1A4FB2400C8D6ABA00DC8E1F /* jstypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jstypes.h; path = src/jstypes.h; sourceTree = "<group>"; };
1A4FB3330C8DC86800DC8E1F /* OOJSOolite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOJSOolite.h; sourceTree = "<group>"; };
1A4FB3340C8DC86800DC8E1F /* OOJSOolite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOJSOolite.m; sourceTree = "<group>"; };
1A5218D80D72EC21000865E9 /* OOSpatialReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOSpatialReference.h; sourceTree = "<group>"; };
1A5218DD0D72ECE5000865E9 /* OOSpatialReference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOSpatialReference.m; sourceTree = "<group>"; };
1A5AA3220C0098AF0029C78A /* OOOpenGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOOpenGL.m; sourceTree = "<group>"; };
1A5BF2720916D47300BF238F /* Oolite-importer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "Oolite-importer.xcodeproj"; path = "Oolite-importer/Oolite-importer.xcodeproj"; sourceTree = "<group>"; };
1A5DB1E80BBD8F0000D57389 /* OOConstToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOConstToString.h; sourceTree = "<group>"; };
@ -2272,6 +2276,8 @@
2516110C099544390037C2E1 /* GameController.m */,
1A60AFB50D56093B0070510D /* OOMusicController.h */,
1A60AFB60D56093B0070510D /* OOMusicController.m */,
1A5218D80D72EC21000865E9 /* OOSpatialReference.h */,
1A5218DD0D72ECE5000865E9 /* OOSpatialReference.m */,
1A2A1B020BD2768300152975 /* Graphics */,
1A5DBA980BC000DC00D57389 /* Scripting */,
1A2DA2A00CB4CB3500DE6823 /* Debug */,
@ -2791,6 +2797,7 @@
1A94D5B50D65A6B40072C805 /* OOCamera.h in Headers */,
1AB4AEB80D688AD9003076D6 /* OOLogHeader.h in Headers */,
1A0DA2EE0D71D280009B0970 /* OOJSSpecialFunctions.h in Headers */,
1A5218DA0D72EC21000865E9 /* OOSpatialReference.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3152,6 +3159,7 @@
1A94D5B60D65A6B40072C805 /* OOCamera.m in Sources */,
1AB4AEB90D688AD9003076D6 /* OOLogHeader.m in Sources */,
1A0DA2EF0D71D280009B0970 /* OOJSSpecialFunctions.m in Sources */,
1A5218DE0D72ECE5000865E9 /* OOSpatialReference.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -87,7 +87,7 @@
$dataCacheStatus = yes;
$dataCacheError = $error;
$dataCacheDebug = no;
dataCache.found = $dataCacheStatus;
dataCache.found = no; // $dataCacheStatus; // Generally redundant since it will be folllowed by .upToDate or .rebuild.*
dataCache.upToDate = $dataCacheStatus;
dataCache.notFound = $dataCacheError;
dataCache.rebuild = $dataCacheStatus;

View File

@ -75,7 +75,7 @@
<key>dataCache.clear.success</key>
<string>$dataCacheDebug</string>
<key>dataCache.found</key>
<string>$dataCacheStatus</string>
<string>no</string>
<key>dataCache.notFound</key>
<string>$dataCacheError</string>
<key>dataCache.prune</key>

View File

@ -198,8 +198,12 @@ OOINLINE void PerformScriptActions(NSArray *actions, Entity *target)
{
NSAutoreleasePool *pool = nil;
mission_key = @"__oolite_actions_temp"; // Allow _actions to have extra-temporary local variables.
PerformScriptActions(some_actions, a_target);
[localVariables removeObjectForKey:mission_key]; // Kill the aforementioned temporary locals.
mission_key = nil;
[pool release];
}

View File

@ -50,19 +50,27 @@ SOFTWARE.
#import "OOCocoa.h"
#import "OOMaths.h"
#import "OOSpatialReference.h"
@interface OOCamera: NSObject
{
Vector _position;
Quaternion _orientation;
Vector _position;
Quaternion _orientation;
id <OOSpatialReference> _reference;
}
- (Vector) position;
- (void) setPosition:(Vector)position;
- (Quaternion) orientation;
- (void) setOrientation:(Quaternion)orientation;
// If reference is not nil, position and orientation are relative to reference.
- (id <OOSpatialReference>)reference;
- (void) setReference:(id <OOSpatialReference>)reference;
- (void) rotateToHeading:(Vector)heading upVector:(Vector)upVector;
- (OOMatrix) transformationMatrix;

View File

@ -63,9 +63,20 @@ SOFTWARE.
}
- (void) dealloc
{
[_reference autorelease];
[super dealloc];
}
- (NSString *) descriptionComponents
{
return [NSString stringWithFormat:@"position: %@ orientation: %@", VectorDescription([self position]), QuaternionDescription([self orientation])];
NSString *refDesc = @"none";
if (_reference != nil) refDesc = [NSString stringWithFormat:@"<%@ %p>", [_reference class], _reference];
return [NSString stringWithFormat:@"position: %@ orientation: %@ reference: %@", VectorDescription([self position]), QuaternionDescription([self orientation]), refDesc];
}
@ -93,6 +104,19 @@ SOFTWARE.
}
- (id <OOSpatialReference>)reference
{
return _reference;
}
- (void) setReference:(id <OOSpatialReference>)reference
{
[_reference autorelease];
_reference = [reference retain];
}
- (void) rotateToHeading:(Vector)heading upVector:(Vector)upVector
{

View File

@ -0,0 +1,43 @@
/*
OOSpatialReference.h
Formal protocol for objects whose transformation matrix (and thus, position
and orientation) can be observed. Currently used for cameras, potentially
useful for stuff like positional audio (instead of OOSoundReferencePoint).
Oolite
Copyright (C) 2004-2008 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOCocoa.h"
#import "OOMaths.h"
#import "Entity.h"
@protocol OOSpatialReference <NSObject>
- (OOMatrix) transformationMatrix;
@end
@interface Entity (OOSpatialReference) <OOSpatialReference>
@end

View File

@ -0,0 +1,39 @@
/*
OOSpatialReference.m
Oolite
Copyright (C) 2004-2008 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
#import "OOSpatialReference.h"
@implementation Entity (OOSpatialReference)
- (OOMatrix) transformationMatrix
{
OOMatrix rotate = [self rotationMatrix];
OOMatrix translate = OOMatrixForTranslation([self position]);
return OOMatrixMultiply(translate, rotate);
}
@end

View File

@ -49,7 +49,8 @@ OOINLINE Vector make_vector(GLfloat vx, GLfloat vy, GLfloat vz) INLINE_CONST_FUN
/* Generate random vectors. */
Vector OORandomUnitVector(void);
Vector OORandomVector(GLfloat maxLength);
Vector OOVectorRandomSpatial(GLfloat maxLength); // Random vector uniformly distributed in radius-maxLength sphere. (Longer vectors are more common.)
Vector OOVectorRandomRadial(GLfloat maxLength); // Random vector with uniform distribution of direction and radius in radius-maxLength sphere. (Causes clustering at centre.)
/* Multiply vector by scalar (in place) */
OOINLINE void scale_vector(Vector *outVector, GLfloat factor) ALWAYS_INLINE_FUNC NONNULL_FUNC;

View File

@ -41,8 +41,9 @@ NSString *VectorDescription(Vector vector)
/* This generates random vectors distrubuted evenly over the surface of the
unit sphere. It does this the simple way, by generating vectors in the
unit cube and rejecting those outside the unit sphere (and the zero vector),
then normalizing the result.
half-unit cube and rejecting those outside the half-unit sphere (and the
zero vector), then normalizing the result. (Half-unit measures are used
to avoid unnecessary multiplications of randf() values.)
In principle, using three normally-distributed co-ordinates (and again
normalizing the result) would provide the right result without looping, but
@ -58,13 +59,13 @@ Vector OORandomUnitVector(void)
v = make_vector(randf() - 0.5f, randf() - 0.5f, randf() - 0.5f);
m = magnitude2(v);
}
while (m == 0.0f || m > 1.0f);
while (m == 0.0f || m > 0.25f); // We're confining to a sphere of radius 0.5 using the sqared magnitude; 0.5 squared is 0.25.
return vector_normal(v);
}
Vector OORandomVector(GLfloat maxLength)
Vector OOVectorRandomSpatial(GLfloat maxLength)
{
Vector v;
float m;
@ -74,7 +75,13 @@ Vector OORandomVector(GLfloat maxLength)
v = make_vector(randf() - 0.5f, randf() - 0.5f, randf() - 0.5f);
m = magnitude2(v);
}
while (m > 1.0f);
while (m > 0.25f); // We're confining to a sphere of radius 0.5 using the sqared magnitude; 0.5 squared is 0.25.
return vector_multiply_scalar(v, maxLength);
return vector_multiply_scalar(v, maxLength * 2.0f); // 2.0 is to compensate for the 0.5-radius sphere.
}
Vector OOVectorRandomRadial(GLfloat maxLength)
{
return vector_multiply_scalar(OORandomUnitVector(), randf() * maxLength);
}

View File

@ -169,6 +169,7 @@ static JSBool GlobalLog(JSContext *context, JSObject *this, uintN argc, jsval *a
}
// expandDescription(description : String) : String
static JSBool GlobalExpandDescription(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
NSString *string = nil;
@ -181,7 +182,7 @@ static JSBool GlobalExpandDescription(JSContext *context, JSObject *this, uintN
}
// DisplayNameForCommodity(commodityName : String) : String
// displayNameForCommodity(commodityName : String) : String
static JSBool GlobalDisplayNameForCommodity(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
NSString *string = nil;
@ -194,6 +195,7 @@ static JSBool GlobalDisplayNameForCommodity(JSContext *context, JSObject *this,
}
// randomName() : String
static JSBool GlobalRandomName(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
NSString *string = nil;

View File

@ -144,7 +144,7 @@ static NSArray *VersionComponents(void)
returns -1 if the current version of Oolite is less than versionSpec, 0 if
they are equal, and 1 if the current version is newer. versionSpec may be
a string or an array. Example:
if (oolite.compareVersion("1.70") < 0) Log("Old version of Oolite!")
if (0 < oolite.compareVersion("1.70")) Log("Old version of Oolite!")
else this.doStuffThatRequires170()
*/
static JSBool OoliteCompareVersion(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)

View File

@ -67,6 +67,7 @@ static JSBool VectorToArray(JSContext *context, JSObject *this, uintN argc, jsva
static JSBool VectorStaticInterpolate(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool VectorStaticRandom(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool VectorStaticRandomDirection(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSBool VectorStaticRandomDirectionAndLength(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
static JSExtendedClass sVectorClass =
@ -139,7 +140,8 @@ static JSFunctionSpec sVectorStaticMethods[] =
// JS name Function min args
{ "interpolate", VectorStaticInterpolate, 3, },
{ "random", VectorStaticRandom, 0, },
{ "randomDirection", VectorStaticRandomDirection,0, },
{ "randomDirection", VectorStaticRandomDirection, 0, },
{ "randomDirectionAndLength", VectorStaticRandomDirectionAndLength, 0, },
{ 0 }
};
@ -715,17 +717,34 @@ static JSBool VectorStaticInterpolate(JSContext *context, JSObject *this, uintN
}
// random([maxLength : Number]) : Vector
static JSBool VectorStaticRandom(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
double maxLength;
if (argc == 0 || !NumberFromArgumentList(context, @"Vector", @"random", argc, argv, &maxLength, NULL)) maxLength = 1.0;
return VectorToJSValue(context, OORandomVector(maxLength), outResult);
return VectorToJSValue(context, OOVectorRandomSpatial(maxLength), outResult);
}
// randomDirection([scale : Number]) : Vector
static JSBool VectorStaticRandomDirection(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
return VectorToJSValue(context, OORandomUnitVector(), outResult);
double scale;
if (argc == 0 || !NumberFromArgumentList(context, @"Vector", @"randomDirection", argc, argv, &scale, NULL)) scale = 1.0;
return VectorToJSValue(context, vector_multiply_scalar(OORandomUnitVector(), scale), outResult);
}
// randomDirectionAndLength([maxLength : Number]) : Vector
static JSBool VectorStaticRandomDirectionAndLength(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
{
double maxLength;
if (argc == 0 || !NumberFromArgumentList(context, @"Vector", @"randomDirectionAndLength", argc, argv, &maxLength, NULL)) maxLength = 1.0;
return VectorToJSValue(context, OOVectorRandomSpatial(maxLength), outResult);
}