MCPcopy Create free account
hub / github.com/cutdigital/mcut / vec2

Class vec2

tutorials/TextureCoordinates/TextureCoordinates.cpp:73–110  ·  view source on GitHub ↗

simple structure representing a 2d vector and the operations we will perform with it

Source from the content-addressed store, hash-verified

71 McBool& isDerivedFromSrcMesh);
72// simple structure representing a 2d vector and the operations we will perform with it
73struct vec2
74{
75 union
76 {
77 struct
78 {
79 McDouble x, y;
80 };
81 struct
82 {
83 McDouble u, v;
84 };
85 };
86
87 vec2 operator*(const McDouble c) const
88 {
89 vec2 result = {{0.0, 0.0}};
90 result.x = x * c;
91 result.y = y * c;
92 return result;
93 }
94
95 vec2 operator+(const vec2& rhs) const
96 {
97 vec2 result = {{0.0, 0.0}};
98 result.x = x + rhs.x;
99 result.y = y + rhs.y;
100 return result;
101 }
102
103 vec2 operator-(const vec2& rhs) const
104 {
105 vec2 result = {{0.0, 0.0}};
106 result.x = x - rhs.x;
107 result.y = y - rhs.y;
108 return result;
109 }
110};
111
112
113// simple structure representing a 3d vector and the operations we will perform with it

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected