Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
iOS 12 malfunction
-
@AlbertoAEC, seems like a major bug related to this iOS version. For your reference, I see the same issue with iOS 12 on iPhoneX – broken shape running at around 10 fps.
-
Another point of reference for you. I have iOS 11 on my iPad still and it runs fine at 60fps. Sometimes goes down to 58fps when I rotate. I’ll update my iPad to iOS 12 soon and can confirm the slowness most likely.
-
Out of curiosity, have you tried writing this as numpy arrays? You can transform all of the points at the same time, should be a lot faster...
-
@mikael Thank you, I have imagined that. I will wait for future version that fix it.
@jgoalby said:
Another point of reference for you. I have iOS 11 on my iPad still and it runs fine at 60fps. Sometimes goes down to 58fps when I rotate. I’ll update my iPad to iOS 12 soon and can confirm the slowness most likely.
Yes, in previous version I had the same behaviour and it seems you will report the same slowness when you updates.
@JonB said:
Out of curiosity, have you tried writing this as numpy arrays? You can transform all of the points at the same time, should be a lot faster...
Thank you for the info. The script was only for fun purpose and I didn’t though so much.
-
When you say that, in addition to slowness, the picture does not look corredt, can you post a screenie? maybe if we can figure out the cause of the drawing error, we will get to the cause of the slowness.
Does the initial picture, before using touch look ok?
Could you try using update to rotate directly, without using touch?
If those are messed up, then you can set a specific rotation angle, and dump out the points and rotation matricies, and we can check against the theoretical. -
@JonB Both problems seems to be caused by the iOS version. Before update all works perfectly. You can try the code in your own device to try something.
Automatic rotation is already coded in the script posted above. To try it you need to make a single tap at any point of the screen.
I post you two screenshots. First at the initial position and the second one at random angle.
http://i990.photobucket.com/albums/af26/AEC_railsim/9DE5F099-6B4A-40C5-A018-F8C93F338354_zpscu2jzikq.png~original -
Is it fair to say the the corner points seem to be behaving correctly, and the lines have the correct angles, however the line positions appear incorrect?
One problem I see is that you should not be using
update
. This calls the function even if it is not needed. Instead, rename it toupdate_points
and call that from touch_moved and touch_ended.A second issue is that you are creating many, many Vector3D objects, since .center() creates new instances. Might be a memory problem.
As a debug, maybe you can change Linea as follows, and see if the orig/dest are being set correctly (this adds a label to the center of each line).
class Linea (ShapeNode): def __init__(self, orig, dest, *args, **kwargs): ShapeNode.__init__(self, *args, **kwargs) self.lbl=LabelNode('{},{}'.format(orig,dest),font=('<System>',6),color='red') self.add_child(self.lbl) self.line_path(orig, dest) self.stroke_color = '#ffffff' self.anchor_point=(.5,.5) def line_path(self, orig, dest): x1,y1 = orig x2,y2 = dest self.position=((x2-x1)/2. + x1, (y2-y1)/2. + y1) path = ui.Path() path.line_width = 2 path.move_to(x1,y2) path.line_to(x2,y1) self.lbl.text='{}\n{}'.format(orig,dest) self.path = path
I suspect the issue has something to do with how Paths auto reset the bounds, which the original code depends on. Maybe ios12 behaves differently.
Finally, here is a numpy'd version of the code. Does this work for you, and is it faster? -
@JonB, works for me @60 fps, except probably was not made for iPhone as the cube is only partially visible when in landscape mode, and not at all in portrait.
-
@JonB Thank you very much for your help. Your code works perfectly. I barely had used the numpy lib and you made me a lesson of use.
I think too the error is caused by how the version interpret the ui.Path.@mikael change the “centro” variable that is the center point of the 3D figure
self.centro = np.mat([500,400,0]).T
-
I think what was happening is that paths are funny, because their bounds change on you, by which I mean if you draw a line from x=5 to 10, instead they vare drawn from -2.5 to 2.5. The original code was trying to accommodate that by changing the position.
Not sure what would make the code so much slower, nor I could not find any mention of UIBezierPath changes in ios12 change notes.