Skip to content

Commit 583ce6b

Browse files
committed
Rewrite matrices
Version bump
1 parent bfacef7 commit 583ce6b

11 files changed

+301
-258
lines changed

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/doc/
2-
/libs/
1+
/docs/
2+
/lib/
33
/.crystal/
44
/.shards/
55

66

77
# Libraries don't need dependency lock
88
# Dependencies will be locked in application that uses them
99
/shard.lock
10-

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: crystaledge
2-
version: 0.1.0
2+
version: 0.2.0
33

44
authors:
55
- unn4m3d <[email protected]>

spec/crystaledge_spec.cr

+12-4
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,22 @@ describe CrystalEdge::Matrix3 do
112112
(m0 + m1).should eq(m1)
113113
(m1*2.0).should eq(m2)
114114

115-
m0.make_translation!(V2.new(0.0, 1.0))
116-
m0[1, 2].should eq(1.0)
115+
m0.make_translation!(V2.new(2.0, 3.0))
116+
m0.matrix.to_a.should eq([1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, 3.0, 1.0])
117117

118-
m3 = M3.new(StaticArray(Float64, 9).new(0.0))
119-
m4 = M3.new(StaticArray(Float64, 9).new(0.0))
118+
m3 = M3.new(0.0)
119+
m4 = M3.new(0.0)
120120
m4[8] = 1.0
121121
m3.should_not eq(m4)
122122
end
123+
124+
it "is column-major" do
125+
mat = M3.new do |r, c|
126+
c * 10.0 + r
127+
end
128+
129+
mat.matrix.to_a.should eq([0.0, 1.0, 2.0, 10.0, 11.0, 12.0, 20.0, 21.0, 22.0])
130+
end
123131
end
124132

125133
describe CrystalEdge::Matrix4 do

0 commit comments

Comments
 (0)