I lately wrote the following wordy text about non-linear time series analysis (as part of my university course). I'm new to this field and with this text I was trying to get an overall overview about the subject. The text has almost no mathematics but just quick descriptions of the most interesting non-linear models for time-series.
URL/DOI Link: Non-Linear Time Series Prediction: A Survey
Tuesday, 4 February 2020
The following is an explanation of some of the math in the paper "Variational auto-encoders with Student’s t-prior" by Najmeh Abiri1 and Mattias Ohlsson. In particular, I focused on their use of the reparametrization trick in order to train a VA with Student-t distribution instead of a Gaussian distribution.
URL/DOI link: VARIATIONAL AUTO-ENCODERS WITH STUDENT‘S T PRIOR EXCERPT
Friday, 19 May 2017
I needed lately to design levels of a special characteristics where everything is made of tiles and there shouldn't be restrictions on angles between different surfaces -- a group of tiles that lie on the same plane.
So I built a special editor that would help me do such a thing easily, of course using Unity editor scripting, and I'm sharing the code with everyone.
As you can notice from the Video, the editor let you lay out copies of a targeted GameObject on imaginary plane, doing that feels like painting. To create a new plane, you need to toggle on "addNewPlane", I know very awful design, but you can alter that to fit your needs.
I'm sorry I didn't comment the code, it was a one purpose editor, but I built it in away that could be expanded to achieve more than its purpose as always, I just like doing that. All the data needed to drive the Editor is in the "Lib.cs" file, this will let you alter the behavior safely. You can contact me if you have any question.
Source Code - BitBucket Repository
1) Uncommented Code.
2) Most of the Behavior implementation of this Editor is in one File (EditorWindow.cs), this make things a little messy, I'm not sure if you can follow my code, but as I said contact me.
3) The UI and the Gizmo are bad and ugly. As you can see from the video the circle with an arrow pointing randomly is so awful, and I must change it.
Good Points :
1) The needed Data structure of the Editor are under the NameSpace "Lib" (Must change this name in Future versions), They're well structured so you can alter the behavior safely.
2) If you followed the code carefully, you will learn about Editor Scripting and Quaternions.
2) You can contact me :).
Source Code - BitBucket Repository
Wednesday, 6 May 2015
Calling any Native/Java method is computationally expensive. It is highly advisable to keep the number of transitions between managed and native/Java code to a minimum, for the sake of performance and also code clarity" This applies for any plugin available for Unity, or any Managed to Unmanaged code communication. So I designed the plugin to do so without your intervention most of the time!. All reading methods won't actually make any plugin call unless there's data available, and that call is just to notify the plugin that data has been read. But who is responsible for data communication between the Plugin and Unity?, data will be sent automatically when needed according to your configurations of the "BtConnector UI Editor". Defining how many bytes you need in the buffer and when they're sent to your app is very important and critical for performance, using the "BtConnector UI Editor --BtConnector inspector" is easy, just try to alter its options, and you will understand.
This approach works nicely for most of us, minimizing data transition isn't an option for others, because they need real-time data, and they deal with high Baud Rates, even though you can do that with the current plugin, you will sacrifice a drop in Frame Rate.
The solution will be to let you add your own code to the plugin with ease, so you will be able to code your own data logic handling functionality away from unity, and that's what I'm working on now. I'm really bad with deadlines, because this isn't my main job, so I won't say anything about when this will be released. Also notice that I might never release it, if I found out that it just complicate the usability of the plugin, but till now I can't see why it couldn't be an easy and handy functionality for you.
Friday, 30 May 2014
Often, you need smooth curves in your game. One of the popular solutions is implementing cubic Bézier curves. Cubic curves let you feel like there are two points in control of the curve.
|Cubic Bézier Curve|
For an artist who avoids coding, cubic curves provide a great feel of what the end result will look like. In case you're building a tool for artists, you better provide them with those curves. However, for prototyping, what I end up using a lot is quadratic curves. They're very intuitive to include in your code.
|Quadratic Bézier Curves|
They're intuitive because every angle formed by those points (e.g. P0, P1, and P2 in the figure above) represents a bend in the curve. It feels like you're drawing the same curve, but with edges.
|Intutive use of Quadratic Curves|
A quadratic Bézier curve is the path traced by the function B(t), given points P0, P1, and P2,
- If you happened to use Unity, then P0, P1, and P2 could be represented using Vector3 or Vector2. In Unity, Vector3 or Vector2 can be multiplied by a scalar ( t ). t could be a float variable from 0 to 1. t = 0 gives the first point P0 (first point in the curve segment). t = 1 gives the last point P2 (last point in the curve segment).
- I guess that is all you need to get started. Any point on the curve (the red curve in the figure above) can be calculated given a t (notice t = 0.50 in the figure above) and a 3 points ( P0, P1, and P2 in the figure above).
- void Curve (float t, Vector2 P0,Vector2 P1,Vector2 P2)
return (1-t)*( (1-t)*P0 + t*P1 ) + t*( (1-t)*P1 + t*P2 );
- Well, this is just one segment. How do you add more segments? You need to build a datastructure that could capture those multiple segments. There are many examples that have good Bézier implementation. Pick any one you like, it doesn't matter what kind of Bézier curves is being used (Quadratic or Cubic). They have a lot of similar ideas. For example, check out this tutorial.