Friday, August 4, 2017

Tutorial Post 17: Constructing regular icosahedron.


In the tutorial post about folding, we constructed  regular tetrahedron. That was easy: we aligned two equilateral triangles to the sides of another one and folded them to obtain all the needed endpoints.

Now we show how to construct regular icosahedron.


Create two copies of equilateral triangles (as it was made in the folding post) and one outline of regular pentagon. Select the enpoints of the pentagon and set constructive points for scaling the pentagon so that its side will become as long as the side of the triangles.


Invoke scaling with the key sequence  'QMS1'.


Prepare for alignment of the first triangle to the side of pentagon with a three-points transformation. The constructive points may be set as on the following figure:


Invoke the three-points transformation (key sequence 'QMT').


The same way, align the second triangle to the adjacent side of the pentagon:


Now we have to prepare the folding. Fortunately, each triangle is in a distinct set, so we can use the 'N' key to select the set and key sequence 'QSS' to select (and then also bookmark) the traingle.
The constructive points for folding should be set as follows:


After folding ('QMF') you should have something like that:


I have also set light ('QDL') to have different shades on the triangles.

Using cursor jumping, insert the remaining sides of the pentagonal pyramid:



Now we could safely remove the segments, which are the outline of the pentagon, but we will leave them to make the placement of pryramids more visible in the remaining stages.

Now select everything ('QSX'). Extract the selected vertices to a single set ('QSE') and make three copies of the pyramids:


We still need one more triangle. We could have  made one more copy at the begining, but  we are adding it now:




We have to align two of  the pyramids with the triangle using three-points transformations:


Prepare for folding of the aligned pyramids:



After folding you get something like that:




We have to append the last pyramid to our construction. Prepare for three-points transformation:


And execute the transformation. The pyramid has been placed as on the view below:


The construction is almost ready. Remainig triangles can be inserted by cursor jumping to the existing endpoints:


To make the construction balanced we can select all endpoints ('QSX') and remove all segments, which are the outlines of the pentagons ('QD4').
Then

  • Move the cursor to the centroid of the selected endpoins (which is now the center of the icosahedron) with key sequence 'QMJC'.
  • Set the constructive point 'A' ('QPSA')
  • Using INPUTS PAGE ('QI') set cursor's X,Y,Z coordinates to zeroes.
  • Set the constructive point 'B' ('QPSB')
  • Move the (still selected) endpoints by the vector 'AB' (key sequence 'QMM0')
Now we have icosahedron with the center in (0,0,0).


https://mki1967.github.io/mki3d/docs/examples/html_viewer/tutorial-icosahedron.html
Click to see exported to html



Wednesday, July 12, 2017

Tutorial Post 16: Folding.

Folding is a constructive method that makes two rotations of two disjoint sets of endpoints at once.


The inputs of folding operation are:

  • four half-lines with a common initial point 'A':  'AB', 'AC', 'AD' and 'AE', and
  • a point 'F' on one side of the plane 'ABC' indicating the direction of the rotations.

The lines 'AB' and 'AC' are axes of two rotations, such that the half-line 'AD' rotated by the first rotation around the line 'AB' is equal to the half-line 'AE' rotated by the second rotation around the line 'AC'.
Such rotations may not always exist. (It depends on the angles between the half-lines.)

As a simple example, let's make regular tetrahedron.
First make equilateral triangle:

(Do not use 'QMI4', since it would insert three triangles -- the sectors of the polygon)


Then make two  copies of the triangle:


(I have also painted them with different colors.)

Then you can use two three-point transformations to align the triangles as follows (use cursor jumping ('QCJ') to set the input constructive points of the three-point transformations):


Use selecting and bookmarking to bookmark the red triangle and to select the green triangle and use cursor jumping ('QCJ') to set constructive points as follows:


Do folding ('QMF'):


The red and the green triangles have been folded around 'AC' and 'AB', respectively.
Note the point 'V' that is set by folding to denote the half-line 'AV' that is equal to the rotations of 'AD' and 'AE'.

There is still one face missing:


We can add it manually with cursor jumping to the existing endpoints:





The Folding Algorithm (formally derived here) does not use any trigonometric functions, which should have positive impact on the precision of computations.




Monday, July 3, 2017

Tutorial Post 15: Sets.

As noted in Tutorial Post on Data Organisation,  each endpoint has a set attribute. Endpoints are grouped into disjoint sets. The set attribute is just an index of the endpoint's group. There is also a 'current set index', which indicates one of the set indices.

Sets are useful for logical grouping of the endpoints.

  • If the endpoints from different sets have the same position, then you can select only endpoints from the current set by pressing: 'QSS' ("ADD ENDPOINTS FROM THE CURRENT SET TO SELECTION" on Selection Menu).
  • On the other hand, if you have some endpoints selected, then you can create a new set that contains only the selected endpoints, extracting them from their old sets ('QSE') ("EXTRACT THE SELECTED ENDPOINTS TO A NEW SET" on Selection Menu).
  • If you created the copy of selectde endpoints ('QDC...'), then the copies of the  endpoints are placed in a new set. (The glue elements have endpoints in distinct sets.) 
  • If you merge from a file ('QFM') then the sets of the merged endpoints are separate from the existing sets (while all the merged endpoints are selected and you can extract them to a single set if you wish) 


Set Menu is invoked by key sequence: 'QN'


I this menu you can change the current set and restrict visibility to the elements that have all the endpoints in (are included in)  the current set or to the elements that have at least one endpoint in (are incident to) the current set.

In the example we have copied two white segments from set 0  (with segment glues between endpoints).
The copy has been moved and painted red.
The copied endpoints have been automatically placed in new set (set 1).
The endpoints of set one have been selected with key sequence 'QSS', when the current set index was 1, and then bookmarked with 'QSB'.
Then the current set index was changed to 0 (by repeating 'QNN') and the endpitoints of set 0 (current set) have been selected ('QSS').


After pressing 'QN0'  we would see the elements included in current set:


If we pressed 'QN1' then we would see the elements incident to the current set:

(Note that now the glues are also visible.)

We can also display some statistics with 'QNP':



You may also cycle with through the available set indexes and view restrictions, by pressing just the key 'N'.

Note that the set attributes of the endpoints may change  their values while you are not watching, since mki3d tries to minimize the total number of available set indexes, by ensuring that the only index of an empty set is the maximal index. After all, the set attributes are only used to indicate the partitioning of the endpoints, and we do not want to cycle through many empty groups, nor to remember the index numeric values.




Tutorial Post 14: Copying.

We can make copies of selected elements. We will make a copy of the two red segments.


The segments already have been selected (with a key sequence: 'QSX').
We invoke Copy submenu on Data Menu (key sequence: 'QDC'):


Note that there are four kinds of copying. The term 'GLUE' denotes connection between the original and its copy. A segment's endpoint can be connected with its copy by a segment. A segment can be connected with its copy by two triangles. There is no   'GLUE'   option defined for a triangle and its copy. (In most cases you do not want glues between triangles and their copies!)

First, lets make the copy without any 'GLUE' ('QDC0').


The endpoints have been copied and placed in a new (unused) set. The old endpoints are un-selected and their copies are now selected. The copies are placed in the positions of the originals. To see that we have really made a copy, select action 'SELECTION MOVE' (key sequence: 'AS') and   move the selected copy with arrow keys.


Now, lets make copy of the first copy with the glues between the endpoints ('QDC1') and move the selected new copy with arrow key to see the results:


And finally, lets make a copy with glues between the segments ('QDC2') and move the copy:


The key sequence: 'QDC3' would make another copy with both kinds of glues.

Monday, June 12, 2017

MKI SEARCHING GAME with MKI3D stages

MKI SEARCHING GAME has been updated in so that it uses directly the stages  designed with MKI3D. (All that is needed is to design the stage, place it in proper sub-directory and update the file with the index of the stages).

If you want to design your own stages, then clone the GitHub repository of the game with a git  command:
git clone https://github.com/mki1967/mkisg-chrome.git
and follow the instructions in README.md.

Here is a recent screen-cast on YouTube with some stages:



UPDATE: The game version at:


has touch events implemented and can be played in a browser on mobile device.

Saturday, May 13, 2017

Testing distribution on SourceForge and Bintray (Linux)

Update:
I have placed on SourceForge Download mki3dgame  the compiled binary  executable for linux-amd64 of mki3dgame version 1.0 (now updated to version 1.1, with a version for windows_amd64 added)

Now I have placed my first AppImage of the Linux version of the game.
AppImage bundles the executable program with its data (game assets).
You can find more informations about AppImage on the following pages:


All you have to do is to download the file, change its mode to executable:

$ chmod a+x mki3dgame-x86_64.AppImage

and just run it:

$ ./mki3dgame-x86_64.AppImage 

(If you do not care for text messages printed in the terminal, then you can also start the application by clicking on the executable file in a file manager.)

Download mki3dgame



Also available on Bintray  :
  

Tuesday, May 9, 2017

Tip: You Can Use Text-Areas and Text Repositories

With the use of text areas, you can distribute your simple designs directly from the browser to browsers (even without using files on local machine). You can use public text repositories. Here is some data copy-pasted to a Gist with a comment how to load it:

 If successful, you should see something like that:

As another example, you may use the same copy-pasting of raw text files to view the shapes from mki3dgame assets in the following GitHub directories:

Thursday, May 4, 2017

Packages for Go programming language and a Game in Go

I have prepared Go packages in the repository https://github.com/mki1967/go-mki3d that can be used to load  the data produced by MKI3D and display with go-gl tools for OpenGL with Golang.

 As a working example you can find a simple game mki3dgame in https://github.com/mki1967/test-go-mki3d .
To run the game you need to have installed  Go language and the packages:

  • "github.com/go-gl/gl/v3.3-core/gl"
  • "github.com/go-gl/glfw/v3.2/glfw"
  • "github.com/go-gl/mathgl/mgl32"
  • "github.com/mki1967/go-mki3d/mki3d"
  • "github.com/mki1967/go-mki3d/glmki3d"

In the game you have to collect tokens randomly scattered in the stages while avoiding the monsters (they can capture you).
You can design your own stages, monsters, and tokens in MKI3D and place them in respective sub-directories of the assets directory.
 Here is a short screen-cast on YouTube:
https://youtu.be/vp6nhvOqhdU

Monday, March 20, 2017

Tutorial Post 13: Cursor Jumping.

Tutorial Post 13: Cursor Jumping.

While you are moving the cursor with arrow keys and 'B','V','F' keys, the set of reachable positions is limited to the three-dimensional grid of points in the model space separated by cursor step distance in each dimension. You can change the cursor step on the Inputs Page ('QI...'): 


(Note that changing the cursor step also updates the view scale, so that the cursor's size and step remain the same to the observer's view.)
In some cases you may want to move a cursor to some hardly reachable position. For example, you have inserted   a regular polygon (as in Tutorial Post 12) and you want to move the cursor one of its vertices. You may move the the cursor close to the desired vertex (endpoint) and then use the option: 'JUMP TO THE NEAREST ENDPOINT' on the Cursor Menu ('QCJ').



Then the cursor should be moved to the nearest endpoint:


(Note that you have also the option: 'JUMP TO THE NEAREST SELECTED ENDPOINT', which could be useful if you can select between closely placed sets of endpoints.)

Other options for  'CURSOR JUMPING' are available as a sub-menu of  Constructive Methods ('QMJ...').


You can move the cursor to the center of visible constructive points. You can use this option together with the command that sets the constructive points 'U' and 'W' on the bounding box of the selected endpoints ('QMB') available on the Constructive Methods Menu:



 When 'U' and 'W' are the only visible constructive points, the key sequence 'QMJ0' moves the cursor to the center of the bounding box of the selected endpoints.



You may also move the cursor to the centroid (arithmetic mean) of the selected endpoints 'QMJC'. However, be aware that there could be many endpoints in some position, where you see only one selection mark.
There is also option to move the cursor to the intersection of the line 'AB' and the plane 'CDE', where 'ABCDE' are visible constructive endpoints (key sequence 'QMJ1'). See how the yellow cursor has been placed on the figure below:




Saturday, March 18, 2017

Tutorial Post 12: Regular Polygons.

Tutorial Post 12: Regular Polygons.

You may create regular polygons. The option is available on the Constructive Inserting Menu ('QMI...').  Either press the key sequence 'QMI3'  to insert the outline of the polygon made of segments, or press 'QMI4'  to insert the triangles that are sectors of the polygon surface. 


The polygon is placed on one of the planes OXY, OXZ, OYZ, that is most parallel to the screen, and it is centered at the cursor. The endopoints of the polygons' elements are indexed with a new (unused set index). Thus you can select them wit 'QSS' for further manipulations.
The number of polygon's vertices is a parameter that can be set on the Inputs Page ('QI...'):


Thursday, March 9, 2017

Tutorial Post 11: Three-point Transformation.

Tutorial Post 11: Three-point Transformation.

Three-point transformation 'ABC' -> 'DEF' transforms selected endpoints by isometric transformation that transforms the point 'A'  to the point 'D', the half-line 'AB' to the half-line 'DE' and the plane 'ABC' to the plane 'DEF'.  Three-point transformation is available on the constructive methods sub-menu ('QM...').


Before you can apply the transformation you need to set six constructive points ('QPS...' - see Tutorial Post 5) and select the endpoints to be transformed ('QS...' - see Tutorial Post 4):





Then you can execute the transformation (i.e. by the key sequence 'QMT'):




Note that the selected point from point 'A' has been transformed to the point 'D' and the selected segment from 'AB' has been transformed on the line 'DE'.
On the following view from another perspective you can see that the selected points from the plane 'ABC' are transformed on the plane 'DEF'. 





Thursday, February 23, 2017

Display mode.

Display mode.

In the standard (editing) mode you are forced to see the cursor and the upper message on the displayed view:

  Now you can remove the cursor and the upper message from the canvas by pressing the 'D' key:

This is useful if you want to save the current view into image file. You can take a screen-shot or - if you run mki3d in the web-browser - you can save graphics on the right-mouse-button pop-up menu. 
(I have implemented this feature, because I wanted to make some stereoscopic views that don't look like the cursor's selfie ;-)



Pressing any key resumes standard display mode for further editing.


Tuesday, February 7, 2017

Red-blue stereoscopic mode.

Red-blue stereoscopic mode.



Stereoscopic mode visible with red-blue glasses has been added to mki3d. You can toggle stereo/mono mode by pressing the sequence of keys: 'QVS'  (i.e. the 'S' option on the 'View' submenu).
Parameters of the stereoscopic display, such as intensities of the red and blue components and "eye shift"  (half of the  distance between the eyes) can be fine-tuned on the Inputs Page ('QI').

Here you can find some stereo more screen-shots.