reflexion 0.1.47 → 0.1.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +10 -0
  3. data/VERSION +1 -1
  4. data/src/shape.cpp +64 -3
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbba01aa89b281514746d453c7fa419ce6549b575e4f104a10879590b36f7618
4
- data.tar.gz: 22e14f38d1e12250dbcbbef64e277d270199e9803a4f65d4843e97751d718f29
3
+ metadata.gz: e490c3d3e75c2e07cd82f02772eb87b45729bd4dbf7444a01e82e631e2673a33
4
+ data.tar.gz: e52a6698bcc86a4509799637efc4019e76c39eecc5122a9a565455f18b7691e9
5
5
  SHA512:
6
- metadata.gz: f47eedb2578dd14f8bb89921483de7a2a95c2b49a6f10946750f974bf8571ab2de4f9004646fae4548dce697fb443e35524b1bf97558051503d7d2e3f880ec80
7
- data.tar.gz: 5d22c08c4b141058bd1cadf70c0205a5e21873e6a73b3af635b8038a9bd68cae110a707737dbb7e0b38e1b5635d3f2e71047b0a257318890998a6d589bd66711
6
+ metadata.gz: 761419026cc6c7f939d714d67ee47c3d3798a7128666deb6100e470e5e80b0a17ead5747270ca33125bbf0338a39e27c9fa1810e13bde7182cc69e6d3bb12ef7
7
+ data.tar.gz: 4f6900e7f5279eceb728e4e003eae016e68af385bc9a6e9c88ca02d67ab22fe538ad2dd5565e4b177689b1392f01c928bff101d22322bd275446a74f31d9d1e0
data/ChangeLog.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # reflex ChangeLog
2
2
 
3
3
 
4
+ ## [v0.1.49] - 2023-07-11
5
+
6
+ - Fix assertion fail if the view size is 0
7
+
8
+
9
+ ## [v0.1.48] - 2023-07-10
10
+
11
+ - Fix a problem that a rectangle shape would be split into 2 triangles for physics
12
+
13
+
4
14
  ## [v0.1.47] - 2023-06-27
5
15
 
6
16
  - NONE -> TYPE_NONE
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.47
1
+ 0.1.49
data/src/shape.cpp CHANGED
@@ -793,6 +793,67 @@ namespace Reflex
793
793
 
794
794
  uint nsegment = 0;
795
795
 
796
+ Fixture* create_fixtures (Shape* shape) override
797
+ {
798
+ Bounds frame = get_frame();
799
+ bool rect = frame.size() != 0;
800
+ if (rect && !has_rounds())
801
+ return create_rect_fixture(shape, frame);
802
+ else if (rect && nsegment <= 1)
803
+ return create_rect_fixture_without_division(shape, frame);
804
+ else
805
+ return Super::create_fixtures(shape);
806
+ }
807
+
808
+ Fixture* create_rect_fixture (Shape* shape, const Bounds& frame)
809
+ {
810
+ assert(shape);
811
+
812
+ if (!owner)
813
+ invalid_state_error(__FILE__, __LINE__);
814
+
815
+ float ppm = owner->meter2pixel();
816
+ coord l = to_b2coord(frame.x, ppm);
817
+ coord t = to_b2coord(frame.y, ppm);
818
+ coord r = to_b2coord(frame.x + frame.w, ppm);
819
+ coord b = to_b2coord(frame.x + frame.h, ppm);
820
+ b2Vec2 b2points[] = {{l, t}, {l, b}, {r, b}, {r, t}};
821
+
822
+ b2PolygonShape b2shape;
823
+ b2shape.Set(&b2points[0], 4);
824
+
825
+ return FixtureBuilder(shape, &b2shape).fixtures();
826
+ }
827
+
828
+ Fixture* create_rect_fixture_without_division (
829
+ Shape* shape, const Bounds& frame)
830
+ {
831
+ assert(shape);
832
+
833
+ if (!owner)
834
+ invalid_state_error(__FILE__, __LINE__);
835
+
836
+ Polygon polygon = Rays::create_rect(
837
+ frame.x, frame.y, frame.width, frame.height,
838
+ round_left_top, round_right_top,
839
+ round_left_bottom, round_right_bottom,
840
+ 1);
841
+ assert(polygon.size() == 1);
842
+
843
+ float ppm = owner->meter2pixel();
844
+ const Polyline& polyline = polygon[0];
845
+ assert(polyline[0].size() <= 8);
846
+
847
+ b2Vec2 b2points[8];
848
+ for (size_t i = 0; i < polyline.size(); ++i)
849
+ b2points[i] = to_b2vec2(polyline[i], ppm);
850
+
851
+ b2PolygonShape b2shape;
852
+ b2shape.Set(&b2points[0], polyline.size());
853
+
854
+ return FixtureBuilder(shape, &b2shape).fixtures();
855
+ }
856
+
796
857
  Polygon get_polygon_for_shape () const override
797
858
  {
798
859
  return Rays::create_rect(
@@ -968,10 +1029,10 @@ namespace Reflex
968
1029
 
969
1030
  Fixture* create_fixtures (Shape* shape) override
970
1031
  {
971
- Bounds f = get_frame();
972
- bool circle = f.size() != 0 && f.width == f.height;
1032
+ Bounds frame = get_frame();
1033
+ bool circle = frame.size() != 0 && frame.width == frame.height;
973
1034
  if (circle && !has_angle() && !has_hole() && has_fill(shape))
974
- return create_circle_fixture(shape, f);
1035
+ return create_circle_fixture(shape, frame);
975
1036
  else
976
1037
  return Super::create_fixtures(shape);
977
1038
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflexion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.47
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-26 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot