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 setup using setup before any value is valid. And ObjectTarget can be tracked by ObjectTracker after a successful load into the ObjectTracker using ObjectTracker.loadTarget .

Constructor

C: void easyar_ObjectTarget__ctor(easyar_ObjectTarget * * Return)
C++17: ObjectTarget()
Traditional C++: ObjectTarget()
Java: public ObjectTarget()
Kotlin: constructor()
Objective-C: + (easyar_ObjectTarget *) create
Swift: public convenience init()
C#: public ObjectTarget()

createFromParameters

Creates a target from parameters.

C: void easyar_ObjectTarget_createFromParameters(easyar_ObjectTargetParameters * parameters, easyar_OptionalOfObjectTarget * Return)
C++17: static std::optional<std::shared_ptr<ObjectTarget>> createFromParameters(std::shared_ptr<ObjectTargetParameters> parameters)
Traditional C++: static void createFromParameters(ObjectTargetParameters * parameters, ObjectTarget * * Return)
Java: public static @Nullable ObjectTarget createFromParameters(@Nonnull ObjectTargetParameters parameters)
Kotlin: companion object fun createFromParameters(parameters: ObjectTargetParameters): ObjectTarget?
Objective-C: + (easyar_ObjectTarget *)createFromParameters:(easyar_ObjectTargetParameters *)parameters
Swift: public static func createFromParameters(_ parameters: ObjectTargetParameters) -> ObjectTarget?
C#: public static Optional<ObjectTarget> createFromParameters(ObjectTargetParameters parameters)

createFromObjectFile

Creats a target from obj, mtl and jpg/png files.

C: void easyar_ObjectTarget_createFromObjectFile(easyar_String * path, easyar_StorageType storageType, easyar_String * name, easyar_String * uid, easyar_String * meta, float scale, easyar_OptionalOfObjectTarget * Return)
C++17: static std::optional<std::shared_ptr<ObjectTarget>> createFromObjectFile(std::string path, StorageType storageType, std::string name, std::string uid, std::string meta, float scale)
Traditional C++: static void createFromObjectFile(String * path, StorageType storageType, String * name, String * uid, String * meta, float scale, ObjectTarget * * Return)
Java: public static @Nullable ObjectTarget createFromObjectFile(java.lang.@Nonnull String path, int storageType, java.lang.@Nonnull String name, java.lang.@Nonnull String uid, java.lang.@Nonnull String meta, float scale)
Kotlin: companion object fun createFromObjectFile(path: String, storageType: Int, name: String, uid: String, meta: String, scale: Float): ObjectTarget?
Objective-C: + (easyar_ObjectTarget *)createFromObjectFile:(NSString *)path storageType:(easyar_StorageType)storageType name:(NSString *)name uid:(NSString *)uid meta:(NSString *)meta scale:(float)scale
Swift: public static func createFromObjectFile(_ path: String, _ storageType: StorageType, _ name: String, _ uid: String, _ meta: String, _ scale: Float) -> ObjectTarget?
C#: public static Optional<ObjectTarget> createFromObjectFile(string path, StorageType storageType, string name, string uid, string meta, float scale)

setupAll

Setup all targets listed in the json file or json string from path with storageType. This method only parses the json file or string.

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.

See StorageType for more descriptions.

C: void easyar_ObjectTarget_setupAll(easyar_String * path, easyar_StorageType storageType, easyar_ListOfObjectTarget * * Return)
C++17: static std::vector<std::shared_ptr<ObjectTarget>> setupAll(std::string path, StorageType storageType)
Traditional C++: static void setupAll(String * path, StorageType storageType, ListOfObjectTarget * * Return)
Java: public static java.util.@Nonnull ArrayList<@Nonnull ObjectTarget> setupAll(java.lang.@Nonnull String path, int storageType)
Kotlin: companion object fun setupAll(path: String, storageType: Int): ArrayList<ObjectTarget>
Objective-C: + (NSArray<easyar_ObjectTarget *> *)setupAll:(NSString *)path storageType:(easyar_StorageType)storageType
Swift: public static func setupAll(_ path: String, _ storageType: StorageType) -> [ObjectTarget]
C#: public static List<ObjectTarget> setupAll(string path, StorageType storageType)

scale

The scale of model. The value is the physical scale divided by model coordinate system scale. The default value is 1. (Supposing the unit of model coordinate system is 1 meter.)

C: float easyar_ObjectTarget_scale(const easyar_ObjectTarget * This)
C++17: float scale()
Traditional C++: float scale()
Java: public float scale()
Kotlin: fun scale(): Float
Objective-C: - (float)scale
Swift: public func scale() -> Float
C#: public virtual float scale()

boundingBox

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

Vertices's indices are defined and stored following the rule:

  4-----7
 /|    /|
5-----6 |    z
| |   | |    |
| 0---|-3    o---y
|/    |/    /
1-----2    x
C: void easyar_ObjectTarget_boundingBox(easyar_ObjectTarget * This, easyar_ListOfVec3F * * Return)
C++17: std::vector<Vec3F> boundingBox()
Traditional C++: void boundingBox(ListOfVec3F * * Return)
Java: public java.util.@Nonnull ArrayList<@Nonnull Vec3F> boundingBox()
Kotlin: fun boundingBox(): ArrayList<Vec3F>
Objective-C: - (NSArray<easyar_Vec3F *> *)boundingBox
Swift: public func boundingBox() -> [Vec3F]
C#: public virtual List<Vec3F> boundingBox()

setScale

Sets model target scale, this will overwrite the value set in the json file or the default value. The value is the physical scale divided by model coordinate system scale. The default value is 1. (Supposing the unit of model coordinate system is 1 meter.)

It is needed to set the model scale in rendering engine separately.

It also should been done before loading ObjectTarget into ObjectTracker using ObjectTracker.loadTarget .

C: bool easyar_ObjectTarget_setScale(easyar_ObjectTarget * This, float scale)
C++17: bool setScale(float scale)
Traditional C++: bool setScale(float scale)
Java: public boolean setScale(float scale)
Kotlin: fun setScale(scale: Float): Boolean
Objective-C: - (bool)setScale:(float)scale
Swift: public func setScale(_ scale: Float) -> Bool
C#: public virtual bool setScale(float scale)

runtimeID

Returns the target id. A target id is a integer number generated at runtime. This id is non-zero and increasing globally.

C: int easyar_ObjectTarget_runtimeID(const easyar_ObjectTarget * This)
C++17: int runtimeID()
Traditional C++: int runtimeID()
Java: public int runtimeID()
Kotlin: fun runtimeID(): Int
Objective-C: - (int)runtimeID
Swift: public override func runtimeID() -> Int32
C#: public override int runtimeID()

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 a alternative method to distinguish from targets.

C: void easyar_ObjectTarget_uid(const easyar_ObjectTarget * This, easyar_String * * Return)
C++17: std::string uid()
Traditional C++: void uid(String * * Return)
Java: public java.lang.@Nonnull String uid()
Kotlin: fun uid(): String
Objective-C: - (NSString *)uid
Swift: public override func uid() -> String
C#: public override string uid()

name

Returns the target name. Name is used to distinguish targets in a json file.

C: void easyar_ObjectTarget_name(const easyar_ObjectTarget * This, easyar_String * * Return)
C++17: std::string name()
Traditional C++: void name(String * * Return)
Java: public java.lang.@Nonnull String name()
Kotlin: fun name(): String
Objective-C: - (NSString *)name
Swift: public override func name() -> String
C#: public override string name()

setName

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

C: void easyar_ObjectTarget_setName(easyar_ObjectTarget * This, easyar_String * name)
C++17: void setName(std::string name)
Traditional C++: void setName(String * name)
Java: public void setName(java.lang.@Nonnull String name)
Kotlin: fun setName(name: String): Unit
Objective-C: - (void)setName:(NSString *)name
Swift: public override func setName(_ name: String) -> Void
C#: public override void setName(string name)

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++17: std::string meta()
Traditional C++: void meta(String * * Return)
Java: public java.lang.@Nonnull String meta()
Kotlin: fun meta(): String
Objective-C: - (NSString *)meta
Swift: public override func meta() -> String
C#: public override string meta()

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++17: void setMeta(std::string data)
Traditional C++: void setMeta(String * data)
Java: public void setMeta(java.lang.@Nonnull String data)
Kotlin: fun setMeta(data: String): Unit
Objective-C: - (void)setMeta:(NSString *)data
Swift: public override func setMeta(_ data: String) -> Void
C#: public override void setMeta(string data)