Class: CGLM::Vec3
- Inherits:
-
VectorType
- Object
- Base
- VectorType
- CGLM::Vec3
- Defined in:
- lib/cglm/vec3.rb,
ext/cglm/rb_cglm.c
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
- .alignment ⇒ Object
- .one ⇒ Object
-
.random([dest]) ⇒ dest | new Vec3
Fills
destor a new Vec3 with random values, and returns it. -
.random([dest]) ⇒ dest | new Vec3
Fills
destor a new Vec3 with random values, and returns it. - .size ⇒ Object
- .xup ⇒ Object
- .yup ⇒ Object
- .zero ⇒ Object
- .zup ⇒ Object
Instance Method Summary collapse
- #*(other) ⇒ Object
- #+(other) ⇒ Object
- #-(other) ⇒ Object
-
#flip_signs([dest]) ⇒ dest | new Vec3
Flips the sign of each component and places the result into
dest. - #/(other) ⇒ Object
- #==(other) ⇒ Object
-
#=~(other) ⇒ Object
Returns true if the given value is very close to this Vec3.
- #[](index) ⇒ Object
- #[]=(index, val) ⇒ Object
-
#add_scalar(b[, dest]) ⇒ dest | new Vec3
Adds the Numeric
bto each component ofself, placing the result indest. -
#add_scalar!(b) ⇒ self
Adds the Numeric
bto each component ofself, modifyingselfin-place and returning it. -
#add_vec3(b[, dest]) ⇒ dest | new Vec3
Adds
selfandbtogether, placing the result indest. -
#add_vec3!(b) ⇒ self
Adds
selfandbtogether, modifyingselfin-place and returning it. - #addadd(other, dest) ⇒ Object
-
#addadd_vec3(other, dest) ⇒ Object
Adds
selftootherand adds that result todest. -
#angle(other) ⇒ Numeric
Returns the angle between
selfandother, in radians. -
#broadcast!(val) ⇒ self
Sets each member of
selfto the specified Numeric value and returnsself. -
#center(vec[, dest]) ⇒ dest | new Vec3
Finds the center point between
selfandvec. -
#clamp_scalar(min, max[, dest]) ⇒ dest | new Vec3
Clamps each component in
selfto the range given byminandmax. -
#clamp_scalar!(min, max) ⇒ self
Clamps each component in
selfto the range given byminandmax. - #cross(b[, dest]) ⇒ dest | new Vec3
-
#distance(vec) ⇒ Numeric
Returns the distance between this vector and the specified one.
-
#distance2(vec) ⇒ Numeric
Returns the squared distance between this vector and the specified one.
-
#div_scalar(b[, dest]) ⇒ dest | new Vec3
Divides each component in
selfby the scalarband places the result intodest. -
#div_scalar!(b) ⇒ self
Divides each component in
selfby the scalarb. -
#div_vec3(b[, dest]) ⇒ dest | new Vec3
Divides two vectors (component-wise division).
-
#div_vec3!(b) ⇒ self
Divides two vectors (component-wise division).
- #dot(other) ⇒ Object
-
#equalish_scalar(val[, epsilon]) ⇒ Object
Returns true if the given scalar value is very close to each component of this Vec3, false otherwise.
-
#equalish_vec3(other[, epsilon]) ⇒ Object
Returns true if this vector is very close to equal to the given one.
-
#equals_all ⇒ Object
Returns true if each component in this Vec3 has the same exact value.
-
#equals_scalar(val) ⇒ Object
Returns true if the given scalar value exactly equals each component of this Vec3, false otherwise.
-
#equals_vec3(other) ⇒ Object
Returns true if this vector exactly matches the given one.
-
#flip_signs([dest]) ⇒ dest | new Vec3
(also: #invert, #negate)
Flips the sign of each component and places the result into
dest. -
#flip_signs! ⇒ self
(also: #invert!, #negate!)
Flips the sign of each component, modifying
selfin-place. -
#highest ⇒ Numeric
Returns the value of the highest component in this Vec3.
-
#inf? ⇒ Boolean
Returns true if any component in this vector is inf, false otherwise.
- #inspect ⇒ Object
-
#lerp!(from, to, amount) ⇒ self
Performs linear interpolation between
fromandto, both of which should be Vec3's, by the specifiedamountwhich should be a number. -
#lowest ⇒ Numeric
Returns the value of the lowest component in this Vec3.
-
#luminance ⇒ Numeric
Averages the RGB color channels into one value.
-
#max(vec[, dest]) ⇒ dest | new Vec3
Finds the higher of each component (x, y, z) between
selfandvec. -
#min(vec[, dest]) ⇒ dest | new Vec3
Finds the lower of each component (x, y, z) between
selfandvec. -
#mul_scalar(b[, dest]) ⇒ dest | new Vec3
Multiplies each component in
selfwith the scalarband places the result intodest. -
#mul_scalar!(b) ⇒ self
Multiplies each component in
selfwith the scalarb. -
#mul_vec3(b[, dest]) ⇒ dest | new Vec3
Multiplies two vectors (component-wise multiplication).
-
#mul_vec3!(b) ⇒ self
Multiplies two vectors (component-wise multiplication).
- #muladd(other, dest) ⇒ Object
-
#muladd_scalar(other, dest) ⇒ Object
Multiplies
selfwithotherand adds that result todest. -
#muladd_vec3(other, dest) ⇒ Object
Multiplies
selfwithotherand adds that result todest. -
#nan? ⇒ Boolean
Returns true if any component in this vector is nan, false otherwise.
-
#norm ⇒ Numeric
(also: #magnitude, #mag)
Returns the norm (magnitude) of this vector.
-
#norm2 ⇒ Numeric
(also: #magnitude2, #mag2)
Returns the norm (magnitude) of this vector, squared.
-
#normalize([dest]) ⇒ dest | new Vec3
Normalizes
selfand places the result intodest. -
#normalize! ⇒ self
Normalizes
selfin-place, and returnsself. - #one! ⇒ Object
-
#ortho(vec[, dest]) ⇒ dest | new Vec3
Finds an orthogonal/perpendicular vector to
self. -
#project(vec[, dest]) ⇒ dest | new Vec3
Projects
selfonto the given Vec3. -
#project!(vec) ⇒ self
Projects
selfonto the given Vec3. -
#resize(b[, dest]) ⇒ dest | new Vec3
Same as
normalize(self) * b. -
#resize!(b) ⇒ self
Same as
normalize(self) * b. -
#rotate_axis_angle(axis, angle[, dest]) ⇒ dest | new Vec3
Rotates
selfaroundaxis(a Vec3) by the specifiedangle(in radians) using Rodrigues' rotation formula. -
#rotate_axis_angle!(axis, angle) ⇒ self
Rotates
selfaroundaxis(a Vec3) by the specifiedangle(in radians) using Rodrigues' rotation formula. -
#rotate_mat3(mat[, dest]) ⇒ dest | new Vec3
Rotate
selfby the given rotation matrix. -
#rotate_mat3!(mat) ⇒ self
Rotate
selfby the given rotation matrix. -
#rotate_mat4(mat[, dest]) ⇒ dest | new Vec3
Rotate
selfby the given rotation or affine matrix. -
#rotate_mat4!(mat) ⇒ self
Rotate
selfby the given rotation or affine matrix. -
#signs([dest]) ⇒ dest | new Vec3
Places
+1,0or-1into each component ofdestbased on whether the corresponding component of this Vec3 is positive,0/NaN, or negative. - #size ⇒ Object
-
#sqrt([dest]) ⇒ dest | new Vec3
For each component of this Vec3, places the square root of that component into
dest. -
#sub_scalar(b[, dest]) ⇒ dest | new Vec3
Subtracts the Numeric
bfrom each component ofself, placing the result indest. -
#sub_scalar!(b) ⇒ self
Subtracts the Numeric
bfrom each component ofself, modifyingselfin-place and returning it. -
#sub_vec3(b[, dest]) ⇒ dest | new Vec3
Subtracts
bfromself, placing the result indest. -
#sub_vec3!(b) ⇒ self
Subtracts
bfromself, modifyingselfin-place and returning it. - #subadd(other, dest) ⇒ Object
-
#subadd_vec3(other, dest) ⇒ Object
Subtracts
otherfromselfand adds that result todest. -
#to_vec4([last, dest]) ⇒ dest | new Vec4
Places the 3 components of this Vec3 into the first 3 components of the
destVec4. -
#valid? ⇒ Boolean
Returns true if no component in this vector is NaN or infinite, false otherwise.
- #zero! ⇒ Object
Methods inherited from VectorType
#each, #initialize, #to_a, #to_enum
Methods inherited from Base
#copy_to, #dup, #initialize, #initialize_dup
Constructor Details
This class inherits a constructor from CGLM::VectorType
Class Method Details
.alignment ⇒ Object
18 19 20 |
# File 'ext/cglm/rb_cglm_vec3.c', line 18 VALUE rb_cglm_vec3_alignment_bytes(VALUE klass) { return SIZET2NUM(VEC3_ALIGNMENT); } |
.one ⇒ Object
43 44 45 46 47 48 |
# File 'ext/cglm/rb_cglm_vec3.c', line 43 VALUE rb_cglm_vec3_one(VALUE self) { VALUE dest = VEC3_NEW(ALLOC_VEC3); vec3 yup = GLM_VEC3_ONE; memcpy(&VAL2VEC3(dest), &yup, sizeof(vec3)); return dest; } |
.random([dest]) ⇒ dest | new Vec3
Fills dest or a new Vec3 with random values, and returns it.
785 786 787 788 789 790 791 792 793 794 795 |
# File 'ext/cglm/rb_cglm_vec3.c', line 785 VALUE rb_cglm_vec3_new_random(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); VAL2VEC3(dest)[0] = drand48(); VAL2VEC3(dest)[1] = drand48(); VAL2VEC3(dest)[2] = drand48(); return dest; } |
.random([dest]) ⇒ dest | new Vec3
Fills dest or a new Vec3 with random values, and returns it.
785 786 787 788 789 790 791 792 793 794 795 |
# File 'ext/cglm/rb_cglm_vec3.c', line 785 VALUE rb_cglm_vec3_new_random(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); VAL2VEC3(dest)[0] = drand48(); VAL2VEC3(dest)[1] = drand48(); VAL2VEC3(dest)[2] = drand48(); return dest; } |
.size ⇒ Object
14 15 16 |
# File 'ext/cglm/rb_cglm_vec3.c', line 14 VALUE rb_cglm_vec3_size_bytes(VALUE klass) { return SIZET2NUM(vec3_size()); } |
.xup ⇒ Object
22 23 24 25 26 27 |
# File 'ext/cglm/rb_cglm_vec3.c', line 22 VALUE rb_cglm_vec3_xup(VALUE self) { VALUE dest = VEC3_NEW(ALLOC_VEC3); vec3 yup = GLM_XUP; memcpy(&VAL2VEC3(dest), &yup, sizeof(vec3)); return dest; } |
.yup ⇒ Object
29 30 31 32 33 34 |
# File 'ext/cglm/rb_cglm_vec3.c', line 29 VALUE rb_cglm_vec3_yup(VALUE self) { VALUE dest = VEC3_NEW(ALLOC_VEC3); vec3 yup = GLM_YUP; memcpy(&VAL2VEC3(dest), &yup, sizeof(vec3)); return dest; } |
.zero ⇒ Object
50 51 52 53 54 55 |
# File 'ext/cglm/rb_cglm_vec3.c', line 50 VALUE rb_cglm_vec3_zero(VALUE self) { VALUE dest = VEC3_NEW(ALLOC_VEC3); vec3 yup = GLM_VEC3_ZERO; memcpy(&VAL2VEC3(dest), &yup, sizeof(vec3)); return dest; } |
.zup ⇒ Object
36 37 38 39 40 41 |
# File 'ext/cglm/rb_cglm_vec3.c', line 36 VALUE rb_cglm_vec3_zup(VALUE self) { VALUE dest = VEC3_NEW(ALLOC_VEC3); vec3 yup = GLM_ZUP; memcpy(&VAL2VEC3(dest), &yup, sizeof(vec3)); return dest; } |
Instance Method Details
#*(other) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/cglm/vec3.rb', line 48 def *(other) case other when VectorType then mul_vec3(other) when Numeric then mul_scalar(other) else false end end |
#+(other) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/cglm/vec3.rb', line 32 def +(other) case other when VectorType then add_vec3(other) when Numeric then add_scalar(other) else false end end |
#-(other) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/cglm/vec3.rb', line 40 def -(other) case other when VectorType then sub_vec3(other) when Numeric then sub_scalar(other) else false end end |
#flip_signs([dest]) ⇒ dest | new Vec3
Flips the sign of each component and places the result into dest. Returns
dest. If dest is omitted, a new Vec3 is allocated.
360 361 362 363 364 365 366 |
# File 'ext/cglm/rb_cglm_vec3.c', line 360 VALUE rb_cglm_vec3_flip_signs(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_flipsign_to(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#/(other) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/cglm/vec3.rb', line 56 def /(other) case other when VectorType then div_vec3(other) when Numeric then div_scalar(other) else false end end |
#==(other) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cglm/vec3.rb', line 11 def ==(other) case other when VectorType then equals_vec3(other) when Numeric then equals_scalar(other) else false end end |
#=~(other) ⇒ Object
Returns true if the given value is very close to this Vec3. If other
is a scalar (number), each component in this vector must be very close
to the scalar. If it's a vector, it must be a Vec3 or Vec4 and each
component of this Vec3 must be very close to the corresponding component
of other. See #equalish_vec3 and #equalish_scalar.
24 25 26 27 28 29 30 |
# File 'lib/cglm/vec3.rb', line 24 def =~(other) case other when VectorType then equalish_vec3(other) when Numeric then equalish_scalar(other) else false end end |
#[](index) ⇒ Object
3 4 5 6 |
# File 'ext/cglm/rb_cglm_vec3.c', line 3 VALUE rb_cglm_vec3_aref(VALUE self, VALUE index) { CHECK_RANGE(index, 0, 2); return DBL2NUM(VAL2VEC3(self)[NUM2INT(index)]); } |
#[]=(index, val) ⇒ Object
8 9 10 11 12 |
# File 'ext/cglm/rb_cglm_vec3.c', line 8 VALUE rb_cglm_vec3_aset(VALUE self, VALUE index, VALUE val) { CHECK_RANGE(index, 0, 2); VAL2VEC3(self)[NUM2INT(index)] = NUM2DBL(val); return self; } |
#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.
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; } |
#add_scalar!(b) ⇒ self
Adds the Numeric b to each component of self, modifying self in-place
and returning it.
163 164 165 166 |
# File 'ext/cglm/rb_cglm_vec3.c', line 163 VALUE rb_cglm_vec3_add_scalar_self(VALUE self, VALUE b) { glm_vec3_adds(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self)); return self; } |
#add_vec3(b[, dest]) ⇒ dest | new Vec3
Adds self and b together, placing the result in dest. If dest is
omitted, a new Vec3 is created and returned.
102 103 104 105 106 107 108 |
# File 'ext/cglm/rb_cglm_vec3.c', line 102 VALUE rb_cglm_vec3_add_vec3(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_add(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#add_vec3!(b) ⇒ self
Adds self and b together, modifying self in-place and returning it.
153 154 155 156 |
# File 'ext/cglm/rb_cglm_vec3.c', line 153 VALUE rb_cglm_vec3_add_vec3_self(VALUE self, VALUE b) { glm_vec3_add(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self)); return self; } |
#addadd(other, dest) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/cglm/vec3.rb', line 64 def addadd(other, dest) case other when VectorType then addadd_vec3(other, dest) when Numeric then addadd_scalar(other, dest) else false end end |
#addadd_vec3(other, dest) ⇒ Object
Adds self to other and adds that result to dest. Equivalent to
dest += (self + other). Returns dest.
destis not optional for this method, as it is for most others.
312 313 314 315 |
# File 'ext/cglm/rb_cglm_vec3.c', line 312 VALUE rb_cglm_vec3_addadd_vec3(VALUE self, VALUE other, VALUE dest) { glm_vec3_addadd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest)); return dest; } |
#angle(other) ⇒ Numeric
Returns the angle between self and other, in radians.
403 404 405 |
# File 'ext/cglm/rb_cglm_vec3.c', line 403 VALUE rb_cglm_vec3_angle(VALUE self, VALUE other) { return DBL2NUM(glm_vec3_angle(VAL2VEC3(self), VAL2VEC3(other))); } |
#broadcast!(val) ⇒ self
Sets each member of self to the specified Numeric value and returns
self.
631 632 633 634 |
# File 'ext/cglm/rb_cglm_vec3.c', line 631 VALUE rb_cglm_vec3_broadcast_self(VALUE self, VALUE val) { glm_vec3_broadcast(NUM2FLT(val), VAL2VEC3(self)); return self; } |
#center(vec[, dest]) ⇒ dest | new Vec3
Finds the center point between self and vec. Places the result into
dest and returns dest. Creates and returns a new Vec3 if dest is
omitted.
524 525 526 527 528 529 530 |
# File 'ext/cglm/rb_cglm_vec3.c', line 524 VALUE rb_cglm_vec3_center(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_center(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#clamp_scalar(min, max[, dest]) ⇒ dest | new Vec3
Clamps each component in self to the range given by min and max.
Places the result into dest and returns dest. Creates and returns a new
Vec3 if dest is omitted.
596 597 598 599 600 601 602 603 |
# File 'ext/cglm/rb_cglm_vec3.c', line 596 VALUE rb_cglm_vec3_clamp_scalar(int argc, VALUE *argv, VALUE self) { VALUE a, b, dest; rb_scan_args(argc, argv, "21", &a, &b, &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); memcpy(&VAL2VEC3(dest), &VAL2VEC3(self), sizeof(vec3)); glm_vec3_clamp(VAL2VEC3(dest), NUM2FLT(a), NUM2FLT(b)); return dest; } |
#clamp_scalar!(min, max) ⇒ self
Clamps each component in self to the range given by min and max.
Places the result into self and returns self.
610 611 612 613 |
# File 'ext/cglm/rb_cglm_vec3.c', line 610 VALUE rb_cglm_vec3_clamp_scalar_self(VALUE self, VALUE a, VALUE b) { glm_vec3_clamp(VAL2VEC3(self), NUM2FLT(a), NUM2FLT(b)); return self; } |
#cross(b[, dest]) ⇒ dest | new Vec3
72 73 74 75 76 77 78 |
# File 'ext/cglm/rb_cglm_vec3.c', line 72 VALUE rb_cglm_vec3_cross(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_cross(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#distance(vec) ⇒ Numeric
Returns the distance between this vector and the specified one.
544 545 546 |
# File 'ext/cglm/rb_cglm_vec3.c', line 544 VALUE rb_cglm_vec3_distance(VALUE self, VALUE b) { return DBL2NUM(glm_vec3_distance(VAL2VEC3(self), VAL2VEC3(b))); } |
#distance2(vec) ⇒ Numeric
Returns the squared distance between this vector and the specified one.
536 537 538 |
# File 'ext/cglm/rb_cglm_vec3.c', line 536 VALUE rb_cglm_vec3_distance2(VALUE self, VALUE b) { return DBL2NUM(glm_vec3_distance2(VAL2VEC3(self), VAL2VEC3(b))); } |
#div_scalar(b[, dest]) ⇒ dest | new Vec3
Divides each component in self by the scalar b and places the
result into dest. If dest is omitted, a new Vec3 is used
instead. Returns dest.
287 288 289 290 291 292 293 |
# File 'ext/cglm/rb_cglm_vec3.c', line 287 VALUE rb_cglm_vec3_div_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_divs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest)); return dest; } |
#div_scalar!(b) ⇒ self
Divides each component in self by the scalar b. Modifies self
in-place and returns self.
300 301 302 303 |
# File 'ext/cglm/rb_cglm_vec3.c', line 300 VALUE rb_cglm_vec3_div_scalar_self(VALUE self, VALUE b) { glm_vec3_divs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self)); return self; } |
#div_vec3(b[, dest]) ⇒ dest | new Vec3
Divides two vectors (component-wise division). Places the result
in dest and returns dest. If dest is omitted, a new Vec3 is used
instead.
263 264 265 266 267 268 269 |
# File 'ext/cglm/rb_cglm_vec3.c', line 263 VALUE rb_cglm_vec3_div_vec3(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_div(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#div_vec3!(b) ⇒ self
Divides two vectors (component-wise division). Modifies self
in-place and returns self.
276 277 278 279 |
# File 'ext/cglm/rb_cglm_vec3.c', line 276 VALUE rb_cglm_vec3_div_vec3_self(VALUE self, VALUE b) { glm_vec3_div(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self)); return self; } |
#dot(other) ⇒ Object
67 68 69 |
# File 'ext/cglm/rb_cglm_vec3.c', line 67 VALUE rb_cglm_vec3_dot(VALUE self, VALUE other) { return DBL2NUM(glm_vec3_dot(VAL2VEC3(self), VAL2VEC3(self))); } |
#equalish_scalar(val[, epsilon]) ⇒ Object
Returns true if the given scalar value is very close to each component of this Vec3, false otherwise. Useful for dealing with the loss of precision during floating point arithmetic.
651 652 653 654 655 656 657 658 659 660 661 |
# File 'ext/cglm/rb_cglm_vec3.c', line 651 VALUE rb_cglm_vec3_equalish_scalar(int argc, VALUE *argv, VALUE self) { VALUE val, eps; float epsil = FLT_EPSILON; rb_scan_args(argc, argv, "11", &val, &eps); if (!NIL_P(eps)) epsil = NUM2FLT(eps); float s = NUM2FLT(val); vec3 *v = &VAL2VEC3(self); return fabsf((*v)[0] - s) <= eps && fabsf((*v)[1] - s) <= eps && fabsf((*v)[2] - s) <= eps ? Qtrue : Qfalse; } |
#equalish_vec3(other[, epsilon]) ⇒ Object
Returns true if this vector is very close to equal to the given one. Useful for dealing with the loss of precision during floating point arithmetic.
684 685 686 687 688 689 690 691 692 693 694 |
# File 'ext/cglm/rb_cglm_vec3.c', line 684 VALUE rb_cglm_vec3_equalish_vec3(int argc, VALUE *argv, VALUE self) { VALUE val, eps; float epsil = FLT_EPSILON; rb_scan_args(argc, argv, "11", &val, &eps); if (!NIL_P(eps)) epsil = NUM2FLT(eps); vec3 *s = &VAL2VEC3(val); vec3 *v = &VAL2VEC3(self); return fabsf((*v)[0] - (*s)[0]) <= eps && fabsf((*v)[1] - (*s)[1]) <= eps && fabsf((*v)[2] - (*s)[2]) <= eps ? Qtrue : Qfalse; } |
#equals_all ⇒ Object
Returns true if each component in this Vec3 has the same exact value.
667 668 669 |
# File 'ext/cglm/rb_cglm_vec3.c', line 667 VALUE rb_cglm_vec3_equals_all(VALUE self) { return glm_vec3_eq_all(VAL2VEC3(self)) ? Qtrue : Qfalse; } |
#equals_scalar(val) ⇒ Object
Returns true if the given scalar value exactly equals each component of this Vec3, false otherwise.
641 642 643 |
# File 'ext/cglm/rb_cglm_vec3.c', line 641 VALUE rb_cglm_vec3_equals_scalar(VALUE self, VALUE val) { return glm_vec3_eq(VAL2VEC3(self), NUM2FLT(val)) ? Qtrue : Qfalse; } |
#equals_vec3(other) ⇒ Object
Returns true if this vector exactly matches the given one.
675 676 677 |
# File 'ext/cglm/rb_cglm_vec3.c', line 675 VALUE rb_cglm_vec3_equals_vec3(VALUE self, VALUE other) { return glm_vec3_eqv(VAL2VEC3(self), VAL2VEC3(other)) ? Qtrue : Qfalse; } |
#flip_signs([dest]) ⇒ dest | new Vec3 Also known as: invert, negate
Flips the sign of each component and places the result into dest. Returns
dest. If dest is omitted, a new Vec3 is allocated.
360 361 362 363 364 365 366 |
# File 'ext/cglm/rb_cglm_vec3.c', line 360 VALUE rb_cglm_vec3_flip_signs(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_flipsign_to(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#flip_signs! ⇒ self Also known as: invert!, negate!
Flips the sign of each component, modifying self in-place. Returns self.
372 373 374 375 |
# File 'ext/cglm/rb_cglm_vec3.c', line 372 VALUE rb_cglm_vec3_flip_signs_self(VALUE self) { glm_vec3_flipsign(VAL2VEC3(self)); return self; } |
#highest ⇒ Numeric
Returns the value of the highest component in this Vec3.
700 701 702 |
# File 'ext/cglm/rb_cglm_vec3.c', line 700 VALUE rb_cglm_vec3_highest(VALUE self) { return DBL2NUM(glm_vec3_max(VAL2VEC3(self))); } |
#inf? ⇒ Boolean
Returns true if any component in this vector is inf, false otherwise. You should only use this in DEBUG mode or very critical asserts.
726 727 728 |
# File 'ext/cglm/rb_cglm_vec3.c', line 726 VALUE rb_cglm_vec3_is_inf(VALUE self) { return glm_vec3_isinf(VAL2VEC3(self)) ? Qtrue : Qfalse; } |
#inspect ⇒ Object
7 8 9 |
# File 'lib/cglm/vec3.rb', line 7 def inspect "#<#{self.class}@#{addr.to_i.to_s(16)} #{to_a.inspect}>" end |
#lerp!(from, to, amount) ⇒ self
Performs linear interpolation between from and to, both of which should
be Vec3's, by the specified amount which should be a number. Modifies
self in-place and returns self.
621 622 623 624 |
# File 'ext/cglm/rb_cglm_vec3.c', line 621 VALUE rb_cglm_vec3_lerp_self(VALUE self, VALUE from, VALUE to, VALUE amount) { glm_vec3_lerp(VAL2VEC3(from), VAL2VEC3(to), NUM2FLT(amount), VAL2VEC3(self)); return self; } |
#lowest ⇒ Numeric
Returns the value of the lowest component in this Vec3.
708 709 710 |
# File 'ext/cglm/rb_cglm_vec3.c', line 708 VALUE rb_cglm_vec3_lowest(VALUE self) { return DBL2NUM(glm_vec3_min(VAL2VEC3(self))); } |
#luminance ⇒ Numeric
Averages the RGB color channels into one value
7 8 9 |
# File 'ext/cglm/rb_cglm_color.c', line 7 VALUE rb_cglm_color_luminance3(VALUE self) { return DBL2NUM(glm_luminance(VAL2VEC3(self))); } |
#max(vec[, dest]) ⇒ dest | new Vec3
Finds the higher of each component (x, y, z) between self and vec.
Places the result into dest and returns dest. Creates and returns a new
Vec3 if dest is omitted.
554 555 556 557 558 559 560 |
# File 'ext/cglm/rb_cglm_vec3.c', line 554 VALUE rb_cglm_vec3_max(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_maxv(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#min(vec[, dest]) ⇒ dest | new Vec3
Finds the lower of each component (x, y, z) between self and vec.
Places the result into dest and returns dest. Creates and returns a new
Vec3 if dest is omitted.
568 569 570 571 572 573 574 |
# File 'ext/cglm/rb_cglm_vec3.c', line 568 VALUE rb_cglm_vec3_min(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_minv(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#mul_scalar(b[, dest]) ⇒ dest | new Vec3
Multiplies each component in self with the scalar b and places the
result into dest. If dest is omitted, a new Vec3 is used
instead. Returns dest.
217 218 219 220 221 222 223 |
# File 'ext/cglm/rb_cglm_vec3.c', line 217 VALUE rb_cglm_vec3_mul_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_scale(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest)); return dest; } |
#mul_scalar!(b) ⇒ self
Multiplies each component in self with the scalar b. Modifies self
in-place and returns self.
230 231 232 233 |
# File 'ext/cglm/rb_cglm_vec3.c', line 230 VALUE rb_cglm_vec3_mul_scalar_self(VALUE self, VALUE b) { glm_vec3_scale(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self)); return self; } |
#mul_vec3(b[, dest]) ⇒ dest | new Vec3
Multiplies two vectors (component-wise multiplication). Places the result
in dest and returns dest. If dest is omitted, a new Vec3 is used
instead.
193 194 195 196 197 198 199 |
# File 'ext/cglm/rb_cglm_vec3.c', line 193 VALUE rb_cglm_vec3_mul_vec3(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_mul(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#mul_vec3!(b) ⇒ self
Multiplies two vectors (component-wise multiplication). Modifies self
in-place and returns self.
206 207 208 209 |
# File 'ext/cglm/rb_cglm_vec3.c', line 206 VALUE rb_cglm_vec3_mul_vec3_self(VALUE self, VALUE b) { glm_vec3_mul(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self)); return self; } |
#muladd(other, dest) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/cglm/vec3.rb', line 80 def muladd(other, dest) case other when VectorType then muladd_vec3(other, dest) when Numeric then muladd_scalar(other, dest) else false end end |
#muladd_scalar(other, dest) ⇒ Object
Multiplies self with other and adds that result to dest. Equivalent to
dest += (self * other). Returns dest.
otheris a Numeric, not a vector type.destis not optional for this method, as it is for most others.
350 351 352 353 |
# File 'ext/cglm/rb_cglm_vec3.c', line 350 VALUE rb_cglm_vec3_muladd_scalar(VALUE self, VALUE other, VALUE dest) { glm_vec3_muladds(VAL2VEC3(self), NUM2FLT(other), VAL2VEC3(dest)); return dest; } |
#muladd_vec3(other, dest) ⇒ Object
Multiplies self with other and adds that result to dest. Equivalent to
dest += (self * other). Returns dest.
destis not optional for this method, as it is for most others.
336 337 338 339 |
# File 'ext/cglm/rb_cglm_vec3.c', line 336 VALUE rb_cglm_vec3_muladd_vec3(VALUE self, VALUE other, VALUE dest) { glm_vec3_muladd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest)); return dest; } |
#nan? ⇒ Boolean
Returns true if any component in this vector is nan, false otherwise. You should only use this in DEBUG mode or very critical asserts.
717 718 719 |
# File 'ext/cglm/rb_cglm_vec3.c', line 717 VALUE rb_cglm_vec3_is_nan(VALUE self) { return glm_vec3_isnan(VAL2VEC3(self)) ? Qtrue : Qfalse; } |
#norm ⇒ Numeric Also known as: magnitude, mag
Returns the norm (magnitude) of this vector.
93 94 95 |
# File 'ext/cglm/rb_cglm_vec3.c', line 93 VALUE rb_cglm_vec3_norm(VALUE self) { return DBL2NUM(glm_vec3_norm(VAL2VEC3(self))); } |
#norm2 ⇒ Numeric Also known as: magnitude2, mag2
Returns the norm (magnitude) of this vector, squared. Call this rather than
norm ** 2 to avoid an unnecessary square root.
85 86 87 |
# File 'ext/cglm/rb_cglm_vec3.c', line 85 VALUE rb_cglm_vec3_norm2(VALUE self) { return DBL2NUM(glm_vec3_norm2(VAL2VEC3(self))); } |
#normalize([dest]) ⇒ dest | new Vec3
Normalizes self and places the result into dest. If dest is omitted,
a new Vec3 is allocated. Returns dest.
382 383 384 385 386 387 388 |
# File 'ext/cglm/rb_cglm_vec3.c', line 382 VALUE rb_cglm_vec3_normalize(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_normalize_to(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#normalize! ⇒ self
Normalizes self in-place, and returns self.
394 395 396 397 |
# File 'ext/cglm/rb_cglm_vec3.c', line 394 VALUE rb_cglm_vec3_normalize_self(VALUE self) { glm_vec3_normalize(VAL2VEC3(self)); return self; } |
#one! ⇒ Object
62 63 64 65 |
# File 'ext/cglm/rb_cglm_vec3.c', line 62 VALUE rb_cglm_vec3_one_self(VALUE self) { glm_vec3_one(VAL2VEC3(self)); return self; } |
#ortho(vec[, dest]) ⇒ dest | new Vec3
Finds an orthogonal/perpendicular vector to self.
Places the result into dest and returns dest. Creates and returns a new
Vec3 if dest is omitted.
582 583 584 585 586 587 588 |
# File 'ext/cglm/rb_cglm_vec3.c', line 582 VALUE rb_cglm_vec3_ortho(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_ortho(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#project(vec[, dest]) ⇒ dest | new Vec3
Projects self onto the given Vec3. Places the result into dest and
returns dest. Creates and returns a new Vec3 if dest is omitted.
500 501 502 503 504 505 506 |
# File 'ext/cglm/rb_cglm_vec3.c', line 500 VALUE rb_cglm_vec3_project(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_proj(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#project!(vec) ⇒ self
Projects self onto the given Vec3. Places the result into self and
returns self.
513 514 515 516 |
# File 'ext/cglm/rb_cglm_vec3.c', line 513 VALUE rb_cglm_vec3_project_self(VALUE self, VALUE b) { glm_vec3_proj(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self)); return self; } |
#resize(b[, dest]) ⇒ dest | new Vec3
Same as normalize(self) * b. Places the result in dest and
creates a new Vec3 if dest is omitted.
240 241 242 243 244 245 246 |
# File 'ext/cglm/rb_cglm_vec3.c', line 240 VALUE rb_cglm_vec3_resize(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_scale_as(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest)); return dest; } |
#resize!(b) ⇒ self
Same as normalize(self) * b. Modifies self in-place and returns self.
252 253 254 255 |
# File 'ext/cglm/rb_cglm_vec3.c', line 252 VALUE rb_cglm_vec3_resize_self(VALUE self, VALUE b) { glm_vec3_scale_as(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self)); return self; } |
#rotate_axis_angle(axis, angle[, dest]) ⇒ dest | new Vec3
Rotates self around axis (a Vec3) by the specified angle (in radians)
using Rodrigues' rotation formula. Places the result into dest and
returns dest. Allocates a new Vec3 if dest is omitted.
413 414 415 416 417 418 419 420 |
# File 'ext/cglm/rb_cglm_vec3.c', line 413 VALUE rb_cglm_vec3_rotate_axis_angle(int argc, VALUE *argv, VALUE self) { VALUE axis, angle, dest; rb_scan_args(argc, argv, "21", &axis, &angle, &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); memcpy(&VAL2VEC3(dest), &VAL2VEC3(self), sizeof(vec3)); glm_vec3_rotate(VAL2VEC3(dest), NUM2FLT(angle), VAL2VEC3(axis)); return dest; } |
#rotate_axis_angle!(axis, angle) ⇒ self
Rotates self around axis (a Vec3) by the specified angle (in radians)
using Rodrigues' rotation formula. Places the result into self and
returns self.
428 429 430 431 |
# File 'ext/cglm/rb_cglm_vec3.c', line 428 VALUE rb_cglm_vec3_rotate_axis_angle_self(VALUE self, VALUE axis, VALUE angle) { glm_vec3_rotate(VAL2VEC3(self), NUM2FLT(angle), VAL2VEC3(axis)); return self; } |
#rotate_mat3(mat[, dest]) ⇒ dest | new Vec3
Rotate self by the given rotation matrix. Places the result in
dest and returns dest. Creates and returns a new Vec3 if dest is
omitted.
477 478 479 480 481 482 483 |
# File 'ext/cglm/rb_cglm_vec3.c', line 477 VALUE rb_cglm_vec3_rotate_mat3(int argc, VALUE *argv, VALUE self) { VALUE matrix, dest; rb_scan_args(argc, argv, "11", &matrix, &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_rotate_m3(VAL2MAT3(matrix), VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#rotate_mat3!(mat) ⇒ self
Rotate self by the given rotation matrix. Places the result in
self and returns self.
490 491 492 493 |
# File 'ext/cglm/rb_cglm_vec3.c', line 490 VALUE rb_cglm_vec3_rotate_mat3_self(VALUE self, VALUE matrix) { glm_vec3_rotate_m3(VAL2MAT3(matrix), VAL2VEC3(self), VAL2VEC3(self)); return self; } |
#rotate_mat4(mat[, dest]) ⇒ dest | new Vec3
Rotate self by the given rotation or affine matrix. Places the result in
dest and returns dest. Creates and returns a new Vec3 if dest is
omitted.
matformat should be (no perspective):a b c x e f g y i j k z 0 0 0 w
446 447 448 449 450 451 452 |
# File 'ext/cglm/rb_cglm_vec3.c', line 446 VALUE rb_cglm_vec3_rotate_mat4(int argc, VALUE *argv, VALUE self) { VALUE matrix, dest; rb_scan_args(argc, argv, "11", &matrix, &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_rotate_m4(VAL2MAT4(matrix), VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#rotate_mat4!(mat) ⇒ self
Rotate self by the given rotation or affine matrix. Places the result in
self and returns self.
matformat should be (no perspective):a b c x e f g y i j k z 0 0 0 w
466 467 468 469 |
# File 'ext/cglm/rb_cglm_vec3.c', line 466 VALUE rb_cglm_vec3_rotate_mat4_self(VALUE self, VALUE matrix) { glm_vec3_rotate_m4(VAL2MAT4(matrix), VAL2VEC3(self), VAL2VEC3(self)); return self; } |
#signs([dest]) ⇒ dest | new Vec3
Places +1, 0 or -1 into each component of dest based on whether the
corresponding component of this Vec3 is positive, 0/NaN, or negative.
If dest is omitted, a new Vec3 is created and returned.
745 746 747 748 749 750 751 |
# File 'ext/cglm/rb_cglm_vec3.c', line 745 VALUE rb_cglm_vec3_signs(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_sign(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#size ⇒ Object
3 4 5 |
# File 'lib/cglm/vec3.rb', line 3 def size 3 end |
#sqrt([dest]) ⇒ dest | new Vec3
For each component of this Vec3, places the square root of that component
into dest. If dest is omitted, a new Vec3 is created. Returns dest.
758 759 760 761 762 763 764 |
# File 'ext/cglm/rb_cglm_vec3.c', line 758 VALUE rb_cglm_vec3_sqrt(int argc, VALUE *argv, VALUE self) { VALUE dest; rb_scan_args(argc, argv, "01", &dest); if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3); glm_vec3_sqrt(VAL2VEC3(self), VAL2VEC3(dest)); return dest; } |
#sub_scalar(b[, dest]) ⇒ dest | new Vec3
Subtracts the Numeric b from each component of self, placing the result
in dest. If dest is omitted, a new Vec3 is created and returned.
141 142 143 144 145 146 147 |
# File 'ext/cglm/rb_cglm_vec3.c', line 141 VALUE rb_cglm_vec3_sub_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_subs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest)); return dest; } |
#sub_scalar!(b) ⇒ self
Subtracts the Numeric b from each component of self, modifying self
in-place and returning it.
182 183 184 185 |
# File 'ext/cglm/rb_cglm_vec3.c', line 182 VALUE rb_cglm_vec3_sub_scalar_self(VALUE self, VALUE b) { glm_vec3_subs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self)); return self; } |
#sub_vec3(b[, dest]) ⇒ dest | new Vec3
Subtracts b from self, placing the result in dest. If dest is
omitted, a new Vec3 is created and returned.
128 129 130 131 132 133 134 |
# File 'ext/cglm/rb_cglm_vec3.c', line 128 VALUE rb_cglm_vec3_sub_vec3(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_sub(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest)); return dest; } |
#sub_vec3!(b) ⇒ self
Subtracts b from self, modifying self in-place and returning it.
172 173 174 175 |
# File 'ext/cglm/rb_cglm_vec3.c', line 172 VALUE rb_cglm_vec3_sub_vec3_self(VALUE self, VALUE b) { glm_vec3_sub(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self)); return self; } |
#subadd(other, dest) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/cglm/vec3.rb', line 72 def subadd(other, dest) case other when VectorType then subadd_vec3(other, dest) when Numeric then subadd_scalar(other, dest) else false end end |
#subadd_vec3(other, dest) ⇒ Object
Subtracts other from self and adds that result to dest. Equivalent to
dest += (self - other). Returns dest.
destis not optional for this method, as it is for most others.
324 325 326 327 |
# File 'ext/cglm/rb_cglm_vec3.c', line 324 VALUE rb_cglm_vec3_subadd_vec3(VALUE self, VALUE other, VALUE dest) { glm_vec3_subadd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest)); return dest; } |
#to_vec4([last, dest]) ⇒ dest | new Vec4
Places the 3 components of this Vec3 into the first 3 components of the
dest Vec4. Sets the final component to the value of last, which
defaults to 1. If dest is omitted, a new Vec4 is created.
772 773 774 775 776 777 778 779 |
# File 'ext/cglm/rb_cglm_vec3.c', line 772 VALUE rb_cglm_vec3_to_vec4(int argc, VALUE *argv, VALUE self) { VALUE last, dest; rb_scan_args(argc, argv, "02", &last, &dest); if (NIL_P(last)) last = INT2NUM(1); if (NIL_P(dest)) dest = VEC4_NEW(ALLOC_VEC4); glm_vec4(VAL2VEC3(self), NUM2FLT(last), VAL2VEC4(dest)); return dest; } |
#valid? ⇒ Boolean
Returns true if no component in this vector is NaN or infinite, false otherwise. You should only use this in DEBUG mode or very critical asserts.
735 736 737 |
# File 'ext/cglm/rb_cglm_vec3.c', line 735 VALUE rb_cglm_vec3_is_valid(VALUE self) { return glm_vec3_isvalid(VAL2VEC3(self)) ? Qtrue : Qfalse; } |
#zero! ⇒ Object
57 58 59 60 |
# File 'ext/cglm/rb_cglm_vec3.c', line 57 VALUE rb_cglm_vec3_zero_self(VALUE self) { glm_vec3_zero(VAL2VEC3(self)); return self; } |