Ignore:
Timestamp:
Dec 31, 2019, 12:19:53 PM (2 years ago)
Author:
Dmitry Kobets <dkobets@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
f8a8fb1
Parents:
94df8de
git-author:
Dmitry Kobets <dkobets@…> (12/31/19 12:13:34)
git-committer:
Dmitry Kobets <dkobets@…> (12/31/19 12:19:53)
Message:

Refactor vector library classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/vec/vec3.hfa

    r94df8de r250dbae  
    1010}
    1111
    12 
    1312forall (otype T) {
    1413    static inline {
     
    3130    }
    3231
    33     // Assignment
    3432    void ?=?(vec3(T)& vec, vec3(T) other) with (vec) {
    3533        [x,y,z] = other.[x,y,z];
     
    4442    // -
    4543    forall(| subtract(T)) {
    46     vec3(T) ?-?(vec3(T) u, vec3(T) v) { // TODO( can't make this const ref )
     44    vec3(T) ?-?(vec3(T) u, vec3(T) v) {
    4745        return [u.x - v.x, u.y - v.y, u.z - v.z];
    4846    }
     
    5250    }
    5351    }
    54 
    5552    forall(| negate(T)) {
    5653    vec3(T) -?(vec3(T) v) with (v) {
     
    5855    }
    5956    }
    60 
    6157    forall(| { T --?(T&); }) {
    6258    vec3(T)& --?(vec3(T)& v) {
     
    7571    // +
    7672    forall(| add(T)) {
    77     vec3(T) ?+?(vec3(T) u, vec3(T) v) { // TODO( can't make this const ref )
     73    vec3(T) ?+?(vec3(T) u, vec3(T) v) {
    7874        return [u.x + v.x, u.y + v.y, u.z + v.z];
    7975    }
     
    8379    }
    8480    }
    85 
    8681
    8782    forall(| { T ++?(T&); }) {
     
    10196    // *
    10297    forall(| multiply(T)) {
    103     vec3(T) ?*?(vec3(T) v, T scalar) with (v) { // TODO (can't make this const ref)
     98    vec3(T) ?*?(vec3(T) v, T scalar) with (v) {
    10499        return [x * scalar, y * scalar, z * scalar];
    105100    }
    106     vec3(T) ?*?(T scalar, vec3(T) v) { // TODO (can't make this const ref)
     101    vec3(T) ?*?(T scalar, vec3(T) v) {
    107102        return v * scalar;
    108103    }
     
    128123        return [u.x / v.x, u.y / v.y, u.z / v.z];
    129124    }
    130     vec3(T)& ?/=?(vec3(T)& v, T scalar) with (v) {
     125    vec3(T)& ?/=?(vec3(T)& v, T scalar) {
    131126        v = v / scalar;
    132127        return v;
Note: See TracChangeset for help on using the changeset viewer.