Basic algebra for users. When I hear about Matrixes and Vectors I know that troubles are near, because vector algebra can cause me headache. What I usualy need is a basic cookbook with most basic user recipes, "How to do it," and that is what I want to offer here.
 
Basic algebra for users. When I hear about Matrixes and Vectors I know that troubles are near, because vector algebra can cause me headache. What I usualy need is a basic cookbook with most basic user recipes, "How to do it," and that is what I want to offer here.
   −
The most basic space is simple: one origin (point 0, 0, 0), one x-axis (vector 1, 0, 0), y-axis and z-axis. But whenever we place an object in such space, we are not necessarily aware that we also created a subspace - the object space. From this moment, we can place other objects not only in the main space but also in this subspace, using the method addChild, or addParent. Each space is defined by its coordination system, for short '''CS''':
+
The most basic space is simple: one origin (point 0, 0, 0), one x-axis (vector 1, 0, 0), y-axis and z-axis. But whenever we place an object in such space, we are not necessarily aware that we also create a subspace - the object space. From this moment, we can place other objects not only in the main space but also in this subspace, using the method addChild, or addParent. Each space is defined by it's coordination system, for short '''CS''':
 
<pre>
 
<pre>
 
Object3D cube = Primitives.getCube(1f);
 
Object3D cube = Primitives.getCube(1f);
 
[[File:Darai_SubspaceExample.png]]
 
[[File:Darai_SubspaceExample.png]]
   −
The cube in this example is defined in the main CS translated by 5 in the Y direction, but because the sphere is the cubes child, it is defined in the cubes CS, so it is moved by 5 in X direction, but not from the origin of the main CS, but from the origin of the cubes CS.
+
The cube in this example is defined in the main CS translated by 5 in the Y direction, but because the sphere is the cubes child, it is defined in the cube's CS, so it is moved by 5 in X direction, but not from the origin of the main CS, but from the origin of the cube's CS.
    
Similar examples can be found also for rotation and scale and when all those features combine, it can be hard to track them.
 
Similar examples can be found also for rotation and scale and when all those features combine, it can be hard to track them.
 
float[] bbox = object.getMesh().getBoundingBox();
 
float[] bbox = object.getMesh().getBoundingBox();
 
</pre>
 
</pre>
2) The objects pivot is calculated point which means that the basic scale is not well predictable
+
2) The object's pivot is calculated point which means that the basic scale is not well predictable
    
Solution: The pivot is calculated during the Object3D.build() command. After this line, the pivot can be read and edited
 
Solution: The pivot is calculated during the Object3D.build() command. After this line, the pivot can be read and edited
 
object.setRotationPivot(newPivot);
 
object.setRotationPivot(newPivot);
 
</pre>
 
</pre>
3) The object is also scaled by all the scales of its parents, so if the size of the mesh is 1 and the objects scale is 1 that does not mean that the size will be 1, because the object can have a parent with a scale not-equal 1.
+
3) The object is also scaled by all the scales of it's parents, so if the size of the mesh is 1 and the object's scale is 1 that does not mean that the size will be 1, because the object can have a parent with a scale not-equal 1.
   −
Solution: Calculate the size from the scale of all objects parents.
+
Solution: Calculate the size from the scale of all object's parents.
 
<pre>
 
<pre>
 
public static SimpleVector getSize(Object3D object){
 
public static SimpleVector getSize(Object3D object){
    
== Rotate ==
 
== Rotate ==
Unexpected non-MediaWiki exception encountered, of type "Error"
[55e4fbdf] /wiki/index.php?title=Basic_algebra&diff=620&oldid=612 Exception from line 436 of /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php: Call to undefined function each()
Backtrace:
#0 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(546): DiffEngine->diag(integer, integer, integer, integer, integer)
#1 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(347): DiffEngine->compareSeq(integer, integer, integer, integer)
#2 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(228): DiffEngine->diffLocal(array, array)
#3 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(725): DiffEngine->diff(array, array)
#4 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(864): Diff->__construct(array, array)
#5 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DairikiDiff.php(987): MappedDiff->__construct(array, array, array, array)
#6 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/TableDiffFormatter.php(193): WordLevelDiff->__construct(array, array)
#7 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DiffFormatter.php(143): TableDiffFormatter->changed(array, array)
#8 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DiffFormatter.php(83): DiffFormatter->block(integer, integer, integer, integer, array)
#9 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(939): DiffFormatter->format(Diff)
#10 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(844): DifferenceEngine->textDiff(string, string)
#11 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(860): DifferenceEngine->{closure}()
#12 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(813): DifferenceEngine->generateTextDiffBody(string, string)
#13 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(743): DifferenceEngine->generateContentDiffBody(WikitextContent, WikitextContent)
#14 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(665): DifferenceEngine->getDiffBody()
#15 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(635): DifferenceEngine->getDiff(string, string, string)
#16 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/diff/DifferenceEngine.php(443): DifferenceEngine->showDiff(string, string, string)
#17 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Article.php(826): DifferenceEngine->showDiffPage(boolean)
#18 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Article.php(549): Article->showDiffPage()
#19 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/actions/ViewAction.php(44): Article->view()
#20 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Wiki.php(487): ViewAction->show()
#21 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Wiki.php(285): MediaWiki->performAction(Article, Title)
#22 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Wiki.php(647): MediaWiki->performRequest()
#23 /zstore/backups/cn10/home/ws10522/public_html/wiki/includes/Wiki.php(506): MediaWiki->main()
#24 /zstore/backups/cn10/home/ws10522/public_html/wiki/index.php(48): MediaWiki->run()
#25 {main}