Method: CGLM::Vec3#add_scalar

Defined in:
ext/cglm/rb_cglm_vec3.c

#add_scalar(b[, dest]) ⇒ dest | new Vec3

Adds the Numeric b to each component of self, placing the result in dest. If dest is omitted, a new Vec3 is created and returned.

Returns:



115
116
117
118
119
120
121
# File 'ext/cglm/rb_cglm_vec3.c', line 115

VALUE rb_cglm_vec3_add_scalar(int argc, VALUE *argv, VALUE self) {
  VALUE b, dest;
  rb_scan_args(argc, argv, "11", &b, &dest);
  if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
  glm_vec3_adds(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
  return dest;
}