iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x

SCIVector3

@interface SCIVector3 : NSObject

Defines a vector with three single-precision floating-point values.

  • x

    Gets the X component of the vector.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float x;

    Swift

    var x: Float { get }
  • y

    Gets the Y component of the vector.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float y;

    Swift

    var y: Float { get }
  • z

    Gets the Z component of the vector.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float z;

    Swift

    var z: Float { get }
  • Gets the magnitude of the vector.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float length;

    Swift

    var length: Float { get }
  • Creates a vector whose elements have the specified values.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithX:(float)x y:(float)y z:(float)z;

    Swift

    init(x: Float, y: Float, z: Float)

    Parameters

    x

    The X component of the vector.

    y

    The X component of the vector.

    z

    The X component of the vector.

  • Creates a new SCIVector3 object from the another SCIVector3 object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithVector:(nonnull SCIVector3 *)vector;

    Swift

    init(vector: SCIVector3)

    Parameters

    vector

    The specified SCIVector3 to create vector from.

  • Assign new values to the the x, y and z components.

    Declaration

    Objective-C

    - (void)assignX:(float)x y:(float)y z:(float)z;

    Swift

    func assignX(_ x: Float, y: Float, z: Float)

    Parameters

    x

    The X component of the vector.

    y

    The X component of the vector.

    z

    The X component of the vector.

  • Adds two vectors together and stores in current instance.

    Declaration

    Objective-C

    - (void)addVector:(nonnull SCIVector3 *)vec1
             toVector:(nonnull SCIVector3 *)vec2;

    Swift

    func add(_ vec1: SCIVector3, to vec2: SCIVector3)

    Parameters

    vec1

    The first vector.

    vec2

    The second vector.

  • Add another vector with weighted x, y and z components.

    Declaration

    Objective-C

    - (void)addWeighted:(nonnull SCIVector3 *)vector weight:(float)weight;

    Swift

    func addWeighted(_ vector: SCIVector3, weight: Float)

    Parameters

    vector

    The vector to add.

    weight

    The weight to be applied onto vector components.

  • Subtracts the vec2 from vec1 and stores the result in current instance.

    Declaration

    Objective-C

    - (void)substractFrom:(nonnull SCIVector3 *)vec1
                   vector:(nonnull SCIVector3 *)vec2;

    Swift

    func substract(from vec1: SCIVector3, vector vec2: SCIVector3)

    Parameters

    vec1

    The first vector.

    vec2

    The second vector.

  • Multiplies a vector by a specified scalar.

    Declaration

    Objective-C

    - (void)multiplyBy:(float)scalar;

    Swift

    func multiply(by scalar: Float)

    Parameters

    scalar

    The scalar value.

  • Makes the current vector a normal vector.

    Declaration

    Objective-C

    - (void)normalize;

    Swift

    func normalize()
  • Computes the cross product of two vectors ans stores it.

    Declaration

    Objective-C

    - (void)cross:(nonnull SCIVector3 *)vec1 with:(nonnull SCIVector3 *)vec2;

    Swift

    func cross(_ vec1: SCIVector3, with vec2: SCIVector3)

    Parameters

    vec1

    The first vector.

    vec2

    The second vector.

  • Computes the dot product of self and passed in vector.

    Declaration

    Objective-C

    - (float)dot:(nonnull SCIVector3 *)vec;

    Swift

    func dot(_ vec: SCIVector3) -> Float

    Parameters

    vec

    The vector.

    Return Value

    The dot product.