atVec<T> method

T atVec<T>(
  1. int row,
  2. int col
)

Implementation

T atVec<T>(int row, int col) {
  // Vec2b, Vec3b, Vec4b
  if (T == Vec2b) {
    return Vec2b.fromPointer(cffi.Mat_GetVec2b(ref, row, col)) as T;
  } else if (T == Vec3b) {
    return Vec3b.fromPointer(cffi.Mat_GetVec3b(ref, row, col)) as T;
  } else if (T == Vec4b) {
    return Vec4b.fromPointer(cffi.Mat_GetVec4b(ref, row, col)) as T;
  }
  // Vec2w, Vec3w, Vec4w
  else if (T == Vec2w) {
    return Vec2w.fromPointer(cffi.Mat_GetVec2w(ref, row, col)) as T;
  } else if (T == Vec3w) {
    return Vec3w.fromPointer(cffi.Mat_GetVec3w(ref, row, col)) as T;
  } else if (T == Vec4w) {
    return Vec4w.fromPointer(cffi.Mat_GetVec4w(ref, row, col)) as T;
  }
  // Vec2s, Vec3s, Vec4s
  else if (T == Vec2s) {
    return Vec2s.fromPointer(cffi.Mat_GetVec2s(ref, row, col)) as T;
  } else if (T == Vec3s) {
    return Vec3s.fromPointer(cffi.Mat_GetVec3s(ref, row, col)) as T;
  } else if (T == Vec4s) {
    return Vec4s.fromPointer(cffi.Mat_GetVec4s(ref, row, col)) as T;
  }
  // Vec2i, Vec3i, Vec4i, Vec6i, Vec8i
  else if (T == Vec2i) {
    return Vec2i.fromPointer(cffi.Mat_GetVec2i(ref, row, col)) as T;
  } else if (T == Vec3i) {
    return Vec3i.fromPointer(cffi.Mat_GetVec3i(ref, row, col)) as T;
  } else if (T == Vec4i) {
    return Vec4i.fromPointer(cffi.Mat_GetVec4i(ref, row, col)) as T;
  } else if (T == Vec6i) {
    return Vec6i.fromPointer(cffi.Mat_GetVec6i(ref, row, col)) as T;
  } else if (T == Vec8i) {
    return Vec8i.fromPointer(cffi.Mat_GetVec8i(ref, row, col)) as T;
  }
  // Vec2f, Vec3f, Vec4f, Vec6f
  else if (T == Vec2f) {
    return Vec2f.fromPointer(cffi.Mat_GetVec2f(ref, row, col)) as T;
  } else if (T == Vec3f) {
    return Vec3f.fromPointer(cffi.Mat_GetVec3f(ref, row, col)) as T;
  } else if (T == Vec4f) {
    return Vec4f.fromPointer(cffi.Mat_GetVec4f(ref, row, col)) as T;
  } else if (T == Vec6f) {
    return Vec6f.fromPointer(cffi.Mat_GetVec6f(ref, row, col)) as T;
  }
  // Vec2d, Vec3d, Vec4d, Vec6d
  else if (T == Vec2d) {
    return Vec2d.fromPointer(cffi.Mat_GetVec2d(ref, row, col)) as T;
  } else if (T == Vec3d) {
    return Vec3d.fromPointer(cffi.Mat_GetVec3d(ref, row, col)) as T;
  } else if (T == Vec4d) {
    return Vec4d.fromPointer(cffi.Mat_GetVec4d(ref, row, col)) as T;
  } else if (T == Vec6d) {
    return Vec6d.fromPointer(cffi.Mat_GetVec6d(ref, row, col)) as T;
  } else {
    throw UnsupportedError("at<$T>() for ${type.asString()} is not supported!");
  }
}