Table Of Contents

Previous topic

Matrix44F Record

Next topic

ObjectTracker Class

ObjectTarget Class

Inherits: Target

Description

ObjectTarget represents 3d object targets that can be tracked by ObjectTracker.

The size of ObjectTarget is determined by the obj file. You can change it by changing the object scale, which is default to 1.

A ObjectTarget should be setuped using setup before any value is valid. And ObjectTarget can be tracked by ObjectTracker after a successful load into the ObjectTracker using ObjectTracker.loadTarget or ObjectTracker.loadTargetBlocked.

Constructor

C: void easyar_ObjectTarget__ctor(easyar_ObjectTarget** Return)
C++11: ObjectTarget()
Traditional C++: ObjectTarget()
Java: public ObjectTarget()
Objective-C: + (easyar_ObjectTarget *) create
Swift (since EasyAR SDK 2.1.0): public convenience init()

setup

Setup target using a json file or json string. This method only parses the json file or string.

Setup named target if name is not empty, otherwise load the first target.

If path is json file path, storageType should be App or Assets or Absolute indicating the path type. Paths inside json files should be absolute path or relative path to the json file.

If path is json string, storageType should be (App | Json) or (Assets | Json) or (Absolute | Json). Paths inside json string should be absolute path or relative path to the storageType root.

See StorageType for more descriptions of StorageType.

C: bool easyar_ObjectTarget_setup(easyar_ObjectTarget* This, easyar_String* path, int storageType, easyar_String* name)
C++11: bool setup(std::string path, int storageType, std::string name)
Traditional C++: bool setup(String* path, int storageType, String* name)
Java: public native boolean setup(java.lang.String path, int storageType, java.lang.String name)
Objective-C: - (bool)setup:(NSString *)path storageType:(int)storageType name:(NSString *)name
Swift (since EasyAR SDK 2.1.0): public func setup(_ path: String, _ storageType: Int32, _ name: String) -> Bool

setupAll

Setup all targets listed in the json file or json string from path with storageType. See setup and StorageType for more descriptions of storageType and json file.

C: void easyar_ObjectTarget_setupAll(easyar_String* path, int storageType, easyar_ListOfPointerOfObjectTarget** Return)
C++11: static std::vector<std::shared_ptr<ObjectTarget>> setupAll(std::string path, int storageType)
Traditional C++: static void setupAll(String* path, int storageType, ListOfPointerOfObjectTarget** Return)
Java: public static native java.util.ArrayList<ObjectTarget> setupAll(java.lang.String path, int storageType)
Objective-C: + (NSArray<easyar_ObjectTarget *> *)setupAll:(NSString *)path storageType:(int)storageType
Swift (since EasyAR SDK 2.1.0): public static func setupAll(_ path: String, _ storageType: Int32) -> [ObjectTarget]

scale

Scale of the ObjectTarget. Default value is 1.

C: float easyar_ObjectTarget_scale(const easyar_ObjectTarget* This)
C++11: float scale()
Traditional C++: float scale()
Java: public native float scale()
Objective-C: - (float)scale
Swift (since EasyAR SDK 2.1.0): public func scale() -> Float

boundingBox

The bounding box of object, it contains the 8 points of the box.

C: void easyar_ObjectTarget_boundingBox(easyar_ObjectTarget* This, easyar_ListOfVec3F** Return)
C++11: std::vector<Vec3F> boundingBox()
Traditional C++: void boundingBox(ListOfVec3F** Return)
Java: public native java.util.ArrayList<Vec3F> boundingBox()
Objective-C: - (NSArray<easyar_Vec3F *> *)boundingBox
Swift (since EasyAR SDK 2.1.0): public func boundingBox() -> [Vec3F]

boundingBoxGL

The bounding box of object in OpenGL coordinates and matrix format, it contains the 8 points of the box.

C: void easyar_ObjectTarget_boundingBoxGL(easyar_ObjectTarget* This, easyar_ListOfVec3F** Return)
C++11: std::vector<Vec3F> boundingBoxGL()
Traditional C++: void boundingBoxGL(ListOfVec3F** Return)
Java: public native java.util.ArrayList<Vec3F> boundingBoxGL()
Objective-C: - (NSArray<easyar_Vec3F *> *)boundingBoxGL
Swift (since EasyAR SDK 2.1.0): public func boundingBoxGL() -> [Vec3F]

setScale

set scale of the ObjectTarget.

C: bool easyar_ObjectTarget_setScale(easyar_ObjectTarget* This, float scale)
C++11: bool setScale(float scale)
Traditional C++: bool setScale(float scale)
Java: public native boolean setScale(float scale)
Objective-C: - (bool)setScale:(float)scale
Swift (since EasyAR SDK 2.1.0): public func setScale(_ scale: Float) -> Bool

runtimeID

Returns the target id. A target id is a int number generated at runtime, it is valid (non-zero) only after a successful setup. This id is non-zero and increasing globally.

C: int easyar_ObjectTarget_runtimeID(const easyar_ObjectTarget* This)
C++11: int runtimeID()
Traditional C++: int runtimeID()
Java: public native int runtimeID()
Objective-C: - (int)runtimeID
Swift (since EasyAR SDK 2.1.0): public override func runtimeID() -> Int32

uid

Returns the target uid. A target uid is useful in cloud based algorithms. If no cloud is used, you can set this uid in the json config as an alternative method to distinguish from targets.

C: void easyar_ObjectTarget_uid(const easyar_ObjectTarget* This, easyar_String** Return)
C++11: std::string uid()
Traditional C++: void uid(String** Return)
Java: public native java.lang.String uid()
Objective-C: - (NSString *)uid
Swift (since EasyAR SDK 2.1.0): public override func uid() -> String

name

Returns the target name. Name is used to distinguish targets in a json file. see setup for more details.

C: void easyar_ObjectTarget_name(const easyar_ObjectTarget* This, easyar_String** Return)
C++11: std::string name()
Traditional C++: void name(String** Return)
Java: public native java.lang.String name()
Objective-C: - (NSString *)name
Swift (since EasyAR SDK 2.1.0): public override func name() -> String

meta

Returns the meta data set by setMetaData. Or, in a cloud returned target, returns the meta data set in the cloud server.

C: void easyar_ObjectTarget_meta(const easyar_ObjectTarget* This, easyar_String** Return)
C++11: std::string meta()
Traditional C++: void meta(String** Return)
Java: public native java.lang.String meta()
Objective-C: - (NSString *)meta
Swift (since EasyAR SDK 2.1.0): public override func meta() -> String

setMeta

Set meta data. It will erase previously set data or data from cloud.

C: void easyar_ObjectTarget_setMeta(easyar_ObjectTarget* This, easyar_String* data)
C++11: void setMeta(std::string data)
Traditional C++: void setMeta(String* data)
Java: public native void setMeta(java.lang.String data)
Objective-C: - (void)setMeta:(NSString *)data
Swift (since EasyAR SDK 2.1.0): public override func setMeta(_ data: String) -> Void