From 4bdea746fc35a8c19d62254e466fa9989e80f6f6 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Wed, 4 Aug 2021 22:07:51 +0300 Subject: [PATCH 01/21] Images for polyline --- docs/images/polyline-points-2.png | Bin 0 -> 2912 bytes docs/images/polyline-points.png | Bin 0 -> 2547 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/images/polyline-points-2.png create mode 100644 docs/images/polyline-points.png diff --git a/docs/images/polyline-points-2.png b/docs/images/polyline-points-2.png new file mode 100644 index 0000000000000000000000000000000000000000..716ebb181df3321015fbcc3309a6cb808c54995b GIT binary patch literal 2912 zcmeHJX;>3?8XwLE$~6QLXt>6LAgFlICF;uI7!n8&*2IwatO1~c{pEtU3`)y| zkX;!7pwxgp5*v){;s8K?iUM2zo$2vjSaI?zTS=bxp755s$l5(lp(mVm-1}n$?r|Bi zVeL1jyP7gXxi@L=BWW#T;ac$~PX2Dt(!kMlDt6G}7UqL)T`csyOtrJ33Bx>LF$8JTVaD9k%ICVHuL>9?U-1{`=! zats7>BTRMD%MKP98kL)ZS1C^$edu=kc7|DxBOxGYIsKu;=**+|Y9kMsPykPaD{jR#N~V zLzPQppf0W=8-0^n6h+CRkK@2+U#4Xh!oN>x57+RQ4THK|=IeCeId3$jqq!Ug! z00}h5XQ(j!bpjeQL6zf(@Ur2T`vNSKGJAxF+^FwdM2!cmF78yJ{)I_dJZn6XbJA?% zE{-E%ufu#rTFP##92Vi954UGAEpu2jJjXFFs)YTxJearzn&=aZ++yL(!8dT!qgz{T zk2fO=i$bTmq1f4Ju`9P*!PWu3#UgJOAcQ?BcK-@;A*Jx|G#tW%fslapGeoDBRb?K6 z1U43dkc|Vpr@|Ljnld}$x>K+5&L)A|D%THA4LDI<*@)aGq~;=M1WFkf677|8SV2z@ zSF3V7Rt(0gZ=$#5R%PaI68KmIz7j>g#T!C`cn^r~-`r<+3Vicdf;o8A5Yiqshj@fU z18rJ%3g2C#&w0g9`Hkf$LtEnd1L10|6<5JT?C`5zuK{P6gv0V7CU0*ymI{qAIe$1N z$a-PeTP@u~)zKp#7D&RvumM#t-ZR|BC!HeZ{& z>}t-Jp}yN19!+m|eI~tpQsI#n=#q#$+dK~!%0U9Ce?Hz3!NsV$`JY38Z2Xir3l~%A zB%Q0bx?#&tcO&)mCa*-%9|WHruXnLtiCsx+2m^1KI~)%`!}hM-y6Cg zHRHCl^(4(t4Qlv)akB2=2XXkBnpoMkcKrwcfh)dg6|1=9uhFs_q>Ns{i?UoF&s zLlJKV+Rv%wYr8fo=~WAYy^gNloi)(QH;>V775uLd%1P3t2iE!B&?{v#jfQ}((seLW z?~mO6y7@()QD@i9bpBn?B?&2~@EV+vFWc;4jf=JQ_h4zA&QMUz;tCoBBTW5IfVDo# c^skw>JR2O}b5~UV6^e=h%0WlC)W+-F?+ouEhX4Qo literal 0 HcmV?d00001 diff --git a/docs/images/polyline-points.png b/docs/images/polyline-points.png new file mode 100644 index 0000000000000000000000000000000000000000..68d5d1416b059d3433259b4bb8e4e9f6cf536add GIT binary patch literal 2547 zcmeH}ZBP?O7{@P00?2^@DkdQ!g1lHjQZCA?0uc!yqGD@NQKRT3YQ_p-1SM#IAfPF= zN|7Ycm_mz6Rgf7eA`ssI&0UCP~p{moRlUG&{lS0Z=?QK18A2zEVN-Z0x^>f)!W$$_+xNCHv?OX4vq``Fn zaa^fg2ZWiJ154yMdnYtR7NZC{Oipp2GxyvvT9KRZG2J9+sWV& z^HISXOGz>9;tF>iJr?^%&;b%Cv8UD4w7KN&bRnDoL+jH^C5JRByI4h~vC_InRBe&O@>eo7~9+6^XW_ zEwGf_D?o=<6CAja9QgSvp=UY2p;ZVwz>vbu6pcjSu`QFE+E1y6HYky%WpstF3A)%_ z`qtxhOSzL=ocSxU?x%Y4atFFKO^VZCL$G$=$H%OUb7Me0m1MiS_L=4;=u7^3z~6MH_xdc+CTC^`?!%Hi#D*Wq5RTDO7Y0S!EXFA?XiVJn1 zJ6`=wRXr|sSWM6ON-AfKi%zRW4NcZ0LmL) zf-K^6FNC+f9v~QCx1V^=!S|O6e5LI_(~>kb-lo0WLsRtVleLZgkITFVYO-o}_@zuc zw?HnwGjdY4e0e7Xe{69mam!y$qtkYdqufjwKV9gr1=>g zir}#9mB9jDp-+Yf7I1eGsdI1Mb=a9UOD+~}EgZKQWlFaN-VXhsr>(wlosAsrz>eQ$4O`G?CCM3EYF^Hqp*YG_{c&&qF?h-@VVFBUhz*zjVYq44 zV%~!IYk~N}lLpnKPH$NNPY>D}41&hi8Y_+m&Yd#px;L$LR#yHasoQ}}*bH;%{-5N}dH+AYZ-{ Date: Wed, 4 Aug 2021 22:08:38 +0300 Subject: [PATCH 02/21] Delete tutorial.md --- docs/tutorial.md | 333 ----------------------------------------------- 1 file changed, 333 deletions(-) delete mode 100644 docs/tutorial.md diff --git a/docs/tutorial.md b/docs/tutorial.md deleted file mode 100644 index 15b24b3c..00000000 --- a/docs/tutorial.md +++ /dev/null @@ -1,333 +0,0 @@ -# Tutorial - -#### The main goal of this tutorial is to show all capabilities of ... (this part will be supplemented) - -The simple visualization can be made with function `main`. (this part will be supplemented as well) -```kotlin -import kotlinx.html.div -import space.kscience.dataforge.context.Context -import space.kscience.visionforge.html.ResourceLocation -import space.kscience.visionforge.solid.* -import java.nio.file.Paths - -fun main(){ - val context = Context{ - plugin(Solids) - } - - context.makeVisionFile ( - Paths.get("customFile.html"), - resourceLocation = ResourceLocation.EMBED - ){ - div { - vision { - solid { - } - } - } - } -} -``` -## Solids properties -**We will analyze which basic properties solids have using `box` solid.** - -*Basic properties:* -1. `opacity` - It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. -2. `color` - It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. -3. `rotation` - it's the point, around which the solid will be rotated. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` - pivot around `y axis`, changing `z` - pivot around `z axis`. -4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this - vertical `y` axis and horizontal `Oxz` plane. - -Let's see how properties are set in solids. -The `small box` will have elemental values of properties. If you will not set properties, it will have the same `position`, `color`, `rotation`, and `opacity` values. - -***You can see that `box` take four values. Later, we will discuss what they do in more detail. Now, it does not really matter.*** -```kotlin -box(10, 10, 10, name = "small box"){ - x = 0 - y = 0 - z = 0 - opacity = 1 //100% opacity - color("red") //as string - rotation = Point3D(0, 0, 0) -} -``` -![](../docs/images/small-box.png) - -The `big box` will have properties with custom values. -```kotlin -box(40, 40, 40, name = "big box"){ - x = 20 - y = 10 - z = 60 - opacity = 0.5 //50% opacity - color(0u, 179u, 179u) //color in rgb - rotation = Point3D(60, 80, 0) -} -``` -![](../docs/images/big-rotated-box.png) -If we compare these boxes, we will see all differences. - -Here is the function `main` with both boxes. -```kotlin -fun main(){ - val context = Context{ - plugin(Solids) - } - - context.makeVisionFile ( - Paths.get("customFile.html"), - resourceLocation = ResourceLocation.EMBED - ){ - div { - vision { - solid { - box(10, 10, 10, name = "small box"){ - x = 0 - y = 0 - z = 0 - opacity = 1 //100% opacity - color("red") //as string - rotation = Point3D(0, 0, 0) - } - box(40, 40, 40, name = "big box"){ - x = 20 - y = 10 - z = 60 - opacity = 0.5 //50% opacity - color(0u, 179u, 179u) //rgb - rotation = Point3D(60, 80, 0) - } - } - } - } - } -} -``` -![](../docs/images/two-boxes-1.png) -![](../docs/images/two-boxes-2.png) - -***There is plenty of other properties, especially of those, which you can create by yourself. Here we mention just small part.*** - -## Basic Solids -Now, let's see which solids can be visualized: -### 1) PolyLine -### 2) Box - -First thing which has to be mentioned is that `box` takes four values: `box(x, y, z, name)` -* `x` - x-axis length of the `box` -* `y` - y-axis length of the `box` -* `z` - z-axis length of the `box` - -These values have `Float` type. *`x`, `y`, and `z` are necessary values, which cannot be ignored. You have to set them.* - -* `name` - `box`'es identifier with `String` type. *It's an optional value, but without it you won't be able to control solid.* - -Let's create just usual `box` with equal ribs. - -```kotlin - box(50, 50, 50, name = "box") { - color("pink") - } -``` - ![](../docs/images/box.png) - -Now, let's make `box` with bigger `y` value. - ```kotlin - box(10, 25, 10, name = "high box") { - color("black") - } - ``` -As you can see, only rib of `y-axis` differs from other ribs. - - ![](../docs/images/high-box.png) - -For final trial, let's create `box` with bigger `x` value. - - ```kotlin - box(65, 40, 40, name = "wide box") { - x = 0 - y = 0 - z = 0 - color("black") - } - ``` -Predictably, only `x-axis` rib bigger than other ribs. - - ![](../docs/images/wide-box.png) - -### 3) Sphere - -It takes in two values: `radius`, and `name`. -Actually, `name` is general value for all solids, so do not wonder, since all solids need their own identifier. - -As for `radius`, it has `Float` type, and, as you can guess, it sets radius of the sphere, which will be created. - ```kotlin - sphere(50, name = "sphere") { - x = 0 - y = 0 - z = 0 - opacity = 0.9 - color("blue") - } - ``` - ![](../docs/images/sphere.png) - -### 4) Hexagon - -It is solid which has six edges. It is set by eight values: `node1`,..., `node8`. They all have `Point3D` type, so they are just points, vertices. - -*Six edges are these:* -1) Edge with vertices `node1`, `node4`, `node3`, `node2` -2) Edge with vertices `node1`, `node2`, `node6`, `node5` -3) Edge with vertices `node2`, `node3`, `node7`, `node6` -4) Edge with vertices `node4`, `node8`, `node7`, `node3` -5) Edge with vertices `node1`, `node5`, `node8`, `node4` -6) Edge with vertices `node8`, `node5`, `node6`, `node7` - -![](../docs/images/scheme.png) - -As hexagon takes in specific points, we understand that this solid cannot be moved, it fixed in space, and it can't make pivots. - -Let's make classic parallelepiped. -```kotlin - hexagon( - Point3D(25, 30, 25), - Point3D(35, 30, 25), - Point3D(35, 30, 15), - Point3D(25, 30, 15), - Point3D(30, 18, 20), - Point3D(40, 18, 20), - Point3D(40, 18, 10), - Point3D(30, 18, 10), - name = "classic hexagon"){ - color("green") - } -``` - ![](../docs/images/classic-hexagon.png) - -Now, let's make a custom hexagon. - - ```kotlin - hexagon( - Point3D(5, 30, 5), - Point3D(24, 30, 8), - Point3D(20, 30, -10), - Point3D(5, 30, -7), - Point3D(8, 16, 0), - Point3D(12, 16, 0), - Point3D(10, 16, -5), - Point3D(6.5, 12, -3), - name = "custom_hexagon"){ - color("brown") - } - ``` - ![](../docs/images/custom-hexagon.png) -### 3) Cone -It takes in six values: `bottomRadius`, `height`, `upperRadius`, `startAngle`, `angle`, and `name`. - -Obviously, `bottomRadius` is responsible for radius of a bottom base, and `height` sets height of a cone along the `z-axis`. - -As it takes such values as `upperRadius`, `startAngle`, `angle`, `cone` can build not only usual cones, but also cone segments. Initially, `upperRadius` will have `0.0` value, `startAngle` - `0f`, `angle` - `PI2`, so if you don't set them, you'll get just a simple cone. - -Setting `upperRadius`, you make a frustum cone, since it sets a radius of the upper base of a cone. Set `startAngle`, and `angle` let to cut off segments by planes perpendicular to the base. `startAngle` - an angle, starting with which segment will be left, `angle` - an angle of cone, which will be set from `startAngle`. - -Let's build a classic cone: -```kotlin - cone(60, 80, name = "cone") { - color("beige") - } - ``` - ![](../docs/images/cone-1.png) - ![](../docs/images/cone-2.png) - -First of all, we have to try to build a frustum cone: -```kotlin -cone(60, 80, name = "cone") { - color(0u, 40u, 0u) -} -``` -![](../docs/images/frustum-cone.png) - -Now, we need to make a try to build a cone segment: - -```kotlin -cone(60, 80, angle = PI, name = "cone") { - color(0u, 0u, 200u) -} -``` -![](../docs/images/cone-segment-1.png) -![](../docs/images/cone-segment-2.png) - -Finally, the segment of frustum cone is left for a try: -```kotlin -cone(60, 100, 20, PI*3/4, angle = PI/3, name = "cone") { - color(190u, 0u, 0u) -} -``` -![](../docs/images/frustum-cone-segment.png) - -### 4) Cone Surface -This solid is set by seven values:`bottomOuterRadius`, `bottomInnerRadius`, `height`, `topOuterRadius`, `topInnerRadius`, `startAngle`, and `angle`. - -In addition to `height`, `startAngle`, and `angle`, which work as they work in `cone`, there are some new values. -`bottomOuterRadius`, and `bottomInnerRadius` set properties of the bottom circle, `topOuterRadius`, `topInnerRadius` - of the upper circle. They have no initial value, so that means they have to be set. - -Generally, `cone`, and `coneSurface` buildings work in the same way, it's possible to make `coneSurface`'s fragments as in `cone` - -Let's build usual cone surface with almost all properties set: -```kotlin - coneSurface(60, 50, 30, 10, 100, name = "cone surface") { - color("red") - rotation = Point3D(2, 50, -9) - } - ``` -![](../docs/images/cone-surface-1.png) -![](../docs/images/cone-surface-2.png) - -Now, let's create a cone surface and set all it's properties: - -```kotlin -coneSurface(30, 25, 10, 10, 8,0f, pi*3/4, name = "cone surface") { - color("fuchsia") - rotation = Point3D(2, 50, -9) -} -``` -![](../docs/images/cone-surface-fragment.png) -![](../docs/images/cone-surface-fragment-2.png) - -### 5) Cylinder - -This solid is set by `radius`, and `height`. As you can see by accepting values, there's no option of building fragments of cylinders. - -Here's a demonstration of a cylinder: - -```kotlin -cylinder(40, 100, "cylinder"){ - rotation = Point3D(40, 0, 0) - color("indigo") -} -``` -![](../docs/images/cylinder-1.png) -![](../docs/images/cylinder-2.png) -### 6) Tube - -`tube` takes in `radius`, `height`, `innerRadius`, `startAngle`, `angle`, and `name`. *All values are familiar from `cone`, and `coneSurface` solids.* - -Here is an example of classic tube: -```kotlin -tube(50, 40, 20, name = "usual tube"){ - opacity = 0.4 -} -``` -![](../docs/images/tube.png) - -This is an example of tube fragment: - -```kotlin -tube(50, 40, 20, 0f, PI, name = "fragmented tube"){ - color("white") -} -``` -![](../docs/images/tube-fragment.png) -### 7) Extruded - From 145673752e145dc3dac5c0db859e0a675d441fbf Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Wed, 4 Aug 2021 22:09:15 +0300 Subject: [PATCH 03/21] Updated tutorial, some details left --- docs/tutorial.md | 373 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 docs/tutorial.md diff --git a/docs/tutorial.md b/docs/tutorial.md new file mode 100644 index 00000000..d70d306d --- /dev/null +++ b/docs/tutorial.md @@ -0,0 +1,373 @@ +# Tutorial + +#### The main goal of this tutorial is to show main capabilities of the visualization instrument. + +The simple visualization can be made with function `main`. (this part will be supplemented) +```kotlin +import kotlinx.html.div +import space.kscience.dataforge.context.Context +import space.kscience.visionforge.html.ResourceLocation +import space.kscience.visionforge.solid.* +import java.nio.file.Paths + +fun main(){ + val context = Context{ + plugin(Solids) + } + + context.makeVisionFile ( + Paths.get("nameFile.html"), + resourceLocation = ResourceLocation.EMBED + ){ + div { + //first vision + vision { + solid { + //solids which you want to visualize + } + } + //second vision + vision { + solid { + //solids which you want to visualize + } + } + } + } +} +``` +## Solids properties +**We will analyze which basic properties solids have using `box` solid.** + +*Basic properties:* +1. `opacity` - It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. +2. `color` - It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. +3. `rotation` - it's the point, which set rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` - pivot around `y axis`, changing `z` - pivot around `z axis`. +4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this - vertical `y` axis and horizontal `Oxz` plane. + +Let's see how properties are set in solids. +The `small box` will have elemental values of properties. If you don't set properties, it will have the same `position`, `color`, `rotation`, and `opacity` values. + +***You can see that `box` take four values. Later, we will discuss what they do in more detail. Now, it does not really matter.*** +```kotlin +box(10, 10, 10, name = "small box"){ + x = 0 + y = 0 + z = 0 + opacity = 1 //100% opacity + color("red") //as string + rotation = Point3D(0, 0, 0) +} +``` +![](../docs/images/small-box.png) + +The `big box` will have properties with custom values. +```kotlin +box(40, 40, 40, name = "big box"){ + x = 20 + y = 10 + z = 60 + opacity = 0.5 //50% opacity + color(0u, 179u, 179u) //color in rgb + rotation = Point3D(60, 80, 0) +} +``` +![](../docs/images/big-rotated-box.png) +If we compare these boxes, we will see all differences. + +Here is the function `main` with both boxes. +```kotlin +fun main(){ + val context = Context{ + plugin(Solids) + } + + context.makeVisionFile ( + Paths.get("customFile.html"), + resourceLocation = ResourceLocation.EMBED + ){ + div { + vision { + solid { + box(10, 10, 10, name = "small box"){ + x = 0 + y = 0 + z = 0 + opacity = 1 //100% opacity + color("red") //as string + rotation = Point3D(0, 0, 0) + } + box(40, 40, 40, name = "big box"){ + x = 20 + y = 10 + z = 60 + opacity = 0.5 //50% opacity + color(0u, 179u, 179u) //rgb + rotation = Point3D(60, 80, 0) + } + } + } + } + } +} +``` +![](../docs/images/two-boxes-1.png) +![](../docs/images/two-boxes-2.png) + +***There is plenty of other properties, especially of those, which you can create by yourself. Here we mention just small part.*** + +## Basic Solids +Now, let's see which solids can be visualized: +### 1) PolyLine + +It's scarcely a solid, but it can be visualized, so we mention it. +`polyline` build lines, obviously. Let's take a look at it's work. + +`polyline` requires two values - `points`, and `name`: +* `points` is a `vararg` with `Point3D` type. It takes pairs of points, which you want to connect. +* `name` is an identifier of *any solid*, but in this case it is an identifier of `polyline`. +It's type is `String`. **This value can be required by any solid; +you can set it, you can not to set it, but without you won't be able to control solid, since it won't be inherited.** + +This is an example of polyline with other solid `box`: +```kotlin +box(100, 100, 100, name = "box"){ + x = -10 + y = -10 + z = -10 + opacity = 0.4 +} +polyline(Point3D(30, 20, 10), Point3D(30, -100, 30), Point3D(30, -100, 30), Point3D(50, -100, 30), name = "polyline"){ + color("red") +} +``` + +![](../docs/images/polyline-points.png) +![](../docs/images/polyline-points-2.png) + +### 2) Box + +First thing which has to be mentioned is that `box` takes four values: `box(x, y, z, name)` +* `x` - x-axis length of the `box` +* `y` - y-axis length of the `box` +* `z` - z-axis length of the `box` + +These values have `Float` type. + +*`x`, `y`, and `z` are necessary values, which cannot be ignored. You have to set them.* + +* `name` - `box`'es identifier. You've already met it. + +Let's create just usual `box` with equal ribs. + +```kotlin + box(50, 50, 50, name = "box") { + color("pink") + } +``` + ![](../docs/images/box.png) + +Now, let's make `box` with bigger `y` value. + ```kotlin + box(10, 25, 10, name = "high box") { + color("black") + } + ``` +As you can see, only rib of `y-axis` differs from other ribs. + + ![](../docs/images/high-box.png) + +For final trial, let's create `box` with bigger `x` value. + + ```kotlin + box(65, 40, 40, name = "wide box") { + x = 0 + y = 0 + z = 0 + color("black") + } + ``` +Predictably, only `x-axis` rib bigger than other ribs. + + ![](../docs/images/wide-box.png) + +### 3) Sphere + +It takes in two values: `radius`, and `name`. +We bring you to mind that `name` is a general value for all solids, so do not wonder, since all solids need their own identifier. + +As for `radius`, it has `Float` type, and, as you can guess, it sets radius of the sphere, which will be created. + ```kotlin + sphere(50, name = "sphere") { + x = 0 + y = 0 + z = 0 + opacity = 0.9 + color("blue") + } + ``` + ![](../docs/images/sphere.png) + +### 4) Hexagon + +It is solid which has six edges. It is set by eight values: `node1`,..., `node8`. They all have `Point3D` type, so they are just points, vertices. + +*Six edges are these:* +1) Edge with vertices `node1`, `node4`, `node3`, `node2` +2) Edge with vertices `node1`, `node2`, `node6`, `node5` +3) Edge with vertices `node2`, `node3`, `node7`, `node6` +4) Edge with vertices `node4`, `node8`, `node7`, `node3` +5) Edge with vertices `node1`, `node5`, `node8`, `node4` +6) Edge with vertices `node8`, `node5`, `node6`, `node7` + +![](../docs/images/scheme.png) + +As hexagon takes in specific points, we understand that this solid cannot be moved, it fixed in space, and it can't make pivots. + +Let's make classic parallelepiped. +```kotlin + hexagon( + Point3D(25, 30, 25), + Point3D(35, 30, 25), + Point3D(35, 30, 15), + Point3D(25, 30, 15), + Point3D(30, 18, 20), + Point3D(40, 18, 20), + Point3D(40, 18, 10), + Point3D(30, 18, 10), + name = "classic hexagon"){ + color("green") + } +``` + ![](../docs/images/classic-hexagon.png) + +Now, let's make a custom hexagon. + + ```kotlin + hexagon( + Point3D(5, 30, 5), + Point3D(24, 30, 8), + Point3D(20, 30, -10), + Point3D(5, 30, -7), + Point3D(8, 16, 0), + Point3D(12, 16, 0), + Point3D(10, 16, -5), + Point3D(6.5, 12, -3), + name = "custom_hexagon"){ + color("brown") + } + ``` + ![](../docs/images/custom-hexagon.png) +### 3) Cone +It takes in six values: `bottomRadius`, `height`, `upperRadius`, `startAngle`, `angle`, and `name`. + +Obviously, `bottomRadius` is responsible for radius of a bottom base, and `height` sets height of a cone along the `z-axis`. + +As it takes such values as `upperRadius`, `startAngle`, `angle`, `cone` can build not only usual cones, but also cone segments. Initially, `upperRadius` will have `0.0` value, `startAngle` - `0f`, `angle` - `PI2`, so if you don't set them, you'll get just a simple cone. + +Setting `upperRadius`, you make a frustum cone, since it sets a radius of the upper base of a cone. Set `startAngle`, and `angle` let to cut off segments by planes perpendicular to the base. `startAngle` - an angle, starting with which segment will be left, `angle` - an angle of cone, which will be set from `startAngle`. + +Let's build a classic cone: +```kotlin + cone(60, 80, name = "cone") { + color("beige") + } + ``` + ![](../docs/images/cone-1.png) + ![](../docs/images/cone-2.png) + +First of all, we have to try to build a frustum cone: +```kotlin +cone(60, 80, name = "cone") { + color(0u, 40u, 0u) +} +``` +![](../docs/images/frustum-cone.png) + +Now, we need to make a try to build a cone segment: + +```kotlin +cone(60, 80, angle = PI, name = "cone") { + color(0u, 0u, 200u) +} +``` +![](../docs/images/cone-segment-1.png) +![](../docs/images/cone-segment-2.png) + +Finally, the segment of frustum cone is left for a try: +```kotlin +cone(60, 100, 20, PI*3/4, angle = PI/3, name = "cone") { + color(190u, 0u, 0u) +} +``` +![](../docs/images/frustum-cone-segment.png) + +### 4) Cone Surface +This solid is set by seven values:`bottomOuterRadius`, `bottomInnerRadius`, `height`, `topOuterRadius`, `topInnerRadius`, `startAngle`, and `angle`. + +In addition to `height`, `startAngle`, and `angle`, which work as they work in `cone`, there are some new values. +`bottomOuterRadius`, and `bottomInnerRadius` set properties of the bottom circle, `topOuterRadius`, `topInnerRadius` - of the upper circle. They have no initial value, so that means they have to be set. + +Generally, `cone`, and `coneSurface` buildings work in the same way, it's possible to make `coneSurface`'s fragments as in `cone` + +Let's build usual cone surface with almost all properties set: +```kotlin + coneSurface(60, 50, 30, 10, 100, name = "cone surface") { + color("red") + rotation = Point3D(2, 50, -9) + } + ``` +![](../docs/images/cone-surface-1.png) +![](../docs/images/cone-surface-2.png) + +Now, let's create a cone surface and set all it's properties: + +```kotlin +coneSurface(30, 25, 10, 10, 8,0f, pi*3/4, name = "cone surface") { + color("fuchsia") + rotation = Point3D(2, 50, -9) +} +``` +![](../docs/images/cone-surface-fragment.png) +![](../docs/images/cone-surface-fragment-2.png) + +### 5) Cylinder + +This solid is set by `radius`, and `height`. As you can see by accepting values, there's no option of building fragments of cylinders. + +Here's a demonstration of a cylinder: + +```kotlin +cylinder(40, 100, "cylinder"){ + rotation = Point3D(40, 0, 0) + color("indigo") +} +``` +![](../docs/images/cylinder-1.png) +![](../docs/images/cylinder-2.png) +### 6) Tube + +`tube` takes in `radius`, `height`, `innerRadius`, `startAngle`, `angle`, and `name`. *All values are familiar from `cone`, and `coneSurface` solids.* + +Here is an example of classic tube: +```kotlin +tube(50, 40, 20, name = "usual tube"){ + opacity = 0.4 +} +``` +![](../docs/images/tube.png) + +This is an example of tube fragment: + +```kotlin +tube(50, 40, 20, 0f, PI, name = "fragmented tube"){ + color("white") +} +``` +![](../docs/images/tube-fragment.png) +### 7) Extruded + +`extruded` is set by two values: `shape`, and `layer`. +* `shape` is a value of `List` type. It' s just a list of all points of the solid. *`shape` has to consist of not less than two points!* +* `layer` is `MutableList` types variable. (here is a sentence with description of the work of this function). *The amount of `layer`-s has to be more than one* + From 639a192d59ce1b8bbdb263a380d8515e0aa76793 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Wed, 4 Aug 2021 22:11:09 +0300 Subject: [PATCH 04/21] Small renamings --- .../kscience/visionforge/solid/Extruded.kt | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Extruded.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Extruded.kt index d5943e3a..480da818 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Extruded.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/Extruded.kt @@ -2,9 +2,8 @@ package space.kscience.visionforge.solid import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import space.kscience.visionforge.VisionBuilder -import space.kscience.visionforge.VisionContainerBuilder -import space.kscience.visionforge.set +import space.kscience.dataforge.meta.Config +import space.kscience.visionforge.* import kotlin.math.PI import kotlin.math.cos import kotlin.math.sin @@ -13,7 +12,7 @@ import kotlin.math.sin public typealias Shape2D = List @Serializable -public class Shape2DBuilder(private val points: MutableList = ArrayList()) { +public class Shape2DBuilder(private val points: ArrayList = ArrayList()) { public fun point(x: Number, y: Number) { points.add(Point2D(x, y)) @@ -38,19 +37,9 @@ public data class Layer(var x: Float, var y: Float, var z: Float, var scale: Flo @Serializable @SerialName("solid.extrude") public class Extruded( - public var shape: List = ArrayList(), - public var layers: MutableList = ArrayList() -) : SolidBase(), GeometrySolid { - - public fun shape(block: Shape2DBuilder.() -> Unit) { - this.shape = Shape2DBuilder().apply(block).build() - //TODO send invalidation signal - } - - public fun layer(z: Number, x: Number = 0.0, y: Number = 0.0, scale: Number = 1.0) { - layers.add(Layer(x.toFloat(), y.toFloat(), z.toFloat(), scale.toFloat())) - //TODO send invalidation signal - } + public val shape: List, + public val layers: List +) : SolidBase(), GeometrySolid, VisionPropertyContainer { override fun toGeometry(geometryBuilder: GeometryBuilder) { val shape: Shape2D = shape @@ -103,6 +92,24 @@ public class Extruded( } } +public class ExtrudeBuilder( + public var shape: List = emptyList(), + public var layers: MutableList = ArrayList(), + config: Config = Config() +) : SimpleVisionPropertyContainer(config) { + public fun shape(block: Shape2DBuilder.() -> Unit) { + this.shape = Shape2DBuilder().apply(block).build() + } + + public fun layer(z: Number, x: Number = 0.0, y: Number = 0.0, scale: Number = 1.0) { + layers.add(Layer(x.toFloat(), y.toFloat(), z.toFloat(), scale.toFloat())) + } + + internal fun build(): Extruded = Extruded(shape, layers).apply { configure(config) } +} + @VisionBuilder -public fun VisionContainerBuilder.extrude(name: String? = null, action: Extruded.() -> Unit = {}): Extruded = - Extruded().apply(action).also { set(name, it) } \ No newline at end of file +public fun VisionContainerBuilder.extruded( + name: String? = null, + action: ExtrudeBuilder.() -> Unit = {} +): Extruded = ExtrudeBuilder().apply(action).build().also { set(name, it) } From 89cff65a90dcc6fe09f366da814012378a3dbf5c Mon Sep 17 00:00:00 2001 From: kiruma524 Date: Thu, 5 Aug 2021 16:46:02 +0300 Subject: [PATCH 05/21] Renamings in Gdml --- .../kotlin/space/kscience/visionforge/gdml/GdmlTransformer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/GdmlTransformer.kt b/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/GdmlTransformer.kt index 98b4509e..0bba2f1a 100644 --- a/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/GdmlTransformer.kt +++ b/visionforge-gdml/src/commonMain/kotlin/space/kscience/visionforge/gdml/GdmlTransformer.kt @@ -248,7 +248,7 @@ private class GdmlTransformerEnv(val settings: GdmlTransformer) { name = name ) } - is GdmlXtru -> extrude(name) { + is GdmlXtru -> extruded(name) { shape { solid.vertices.forEach { point(it.x * lScale, it.y * lScale) @@ -284,7 +284,7 @@ private class GdmlTransformerEnv(val settings: GdmlTransformer) { name = name, ) is GdmlOrb -> sphere(solid.r * lScale, name = name) - is GdmlPolyhedra -> extrude(name) { + is GdmlPolyhedra -> extruded(name) { //getting the radius of first require(solid.planes.size > 1) { "The polyhedron geometry requires at least two planes" } val baseRadius = solid.planes.first().rmax * lScale From 426c1ff990b6e115b73602ddba8c5ec2f9794bdd Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:43:13 +0300 Subject: [PATCH 06/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index d70d306d..924b62c5 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -244,18 +244,19 @@ Let's make classic parallelepiped. Now, let's make a custom hexagon. ```kotlin - hexagon( - Point3D(5, 30, 5), - Point3D(24, 30, 8), - Point3D(20, 30, -10), - Point3D(5, 30, -7), - Point3D(8, 16, 0), - Point3D(12, 16, 0), - Point3D(10, 16, -5), - Point3D(6.5, 12, -3), - name = "custom_hexagon"){ - color("brown") - } +hexagon( + Point3D(5, 30, 5), + Point3D(24, 30, 8), + Point3D(20, 30, -10), + Point3D(5, 30, -7), + Point3D(8, 16, 0), + Point3D(12, 16, 0), + Point3D(10, 16, -5), + Point3D(6.5, 12, -3), + name = "custom_hexagon" +) { + color("brown") +} ``` ![](../docs/images/custom-hexagon.png) ### 3) Cone @@ -370,4 +371,3 @@ tube(50, 40, 20, 0f, PI, name = "fragmented tube"){ `extruded` is set by two values: `shape`, and `layer`. * `shape` is a value of `List` type. It' s just a list of all points of the solid. *`shape` has to consist of not less than two points!* * `layer` is `MutableList` types variable. (here is a sentence with description of the work of this function). *The amount of `layer`-s has to be more than one* - From b3ecc2136e0eb922f4953339c6c53152ddcf6b25 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:43:20 +0300 Subject: [PATCH 07/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 924b62c5..83da43d9 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,6 +1,6 @@ # Tutorial -#### The main goal of this tutorial is to show main capabilities of the visualization instrument. +#### The main goal of this tutorial is to show the main capabilities of the visualization instrument. The simple visualization can be made with function `main`. (this part will be supplemented) ```kotlin From 2c2b7a5fa2ec555a388d33414ff72a264bde163c Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:43:34 +0300 Subject: [PATCH 08/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 83da43d9..aeef2aa1 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -120,7 +120,7 @@ fun main(){ Now, let's see which solids can be visualized: ### 1) PolyLine -It's scarcely a solid, but it can be visualized, so we mention it. +It's scarcely a solid, but it can be visualized, so we mention it. `polyline` build lines, obviously. Let's take a look at it's work. `polyline` requires two values - `points`, and `name`: From d5c0afd8c0f641a68870777081c75af0858d9403 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:43:51 +0300 Subject: [PATCH 09/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index aeef2aa1..dfb5f65f 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -369,5 +369,5 @@ tube(50, 40, 20, 0f, PI, name = "fragmented tube"){ ### 7) Extruded `extruded` is set by two values: `shape`, and `layer`. -* `shape` is a value of `List` type. It' s just a list of all points of the solid. *`shape` has to consist of not less than two points!* +* `shape` is a value of `List` type. It's just a list of all points of the solid. *`shape` has to consist of not less than two points!* * `layer` is `MutableList` types variable. (here is a sentence with description of the work of this function). *The amount of `layer`-s has to be more than one* From 6d7356f08c7d0601d401ba50b5dc6a79c6f05ac0 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:43:57 +0300 Subject: [PATCH 10/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index dfb5f65f..97d4a00e 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -187,7 +187,7 @@ For final trial, let's create `box` with bigger `x` value. color("black") } ``` -Predictably, only `x-axis` rib bigger than other ribs. +Predictably, only the `x-axis` rib is bigger than other ribs. ![](../docs/images/wide-box.png) From 689071d0da4a0ee647bac17b7febdcbed9df7841 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:44:28 +0300 Subject: [PATCH 11/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 97d4a00e..0052f3e9 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -196,7 +196,7 @@ Predictably, only the `x-axis` rib is bigger than other ribs. It takes in two values: `radius`, and `name`. We bring you to mind that `name` is a general value for all solids, so do not wonder, since all solids need their own identifier. -As for `radius`, it has `Float` type, and, as you can guess, it sets radius of the sphere, which will be created. +As for `radius`, it has `Float` type, and, as you can guess, it sets the radius of the sphere which will be created. ```kotlin sphere(50, name = "sphere") { x = 0 From 1d7776807183aa9ac8a05f665d4619f297754601 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:44:38 +0300 Subject: [PATCH 12/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 0052f3e9..e8b8a5b0 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -262,7 +262,7 @@ hexagon( ### 3) Cone It takes in six values: `bottomRadius`, `height`, `upperRadius`, `startAngle`, `angle`, and `name`. -Obviously, `bottomRadius` is responsible for radius of a bottom base, and `height` sets height of a cone along the `z-axis`. +Obviously, `bottomRadius` is responsible for the radius of a bottom base, and `height` sets the height of a cone along the `z-axis`. As it takes such values as `upperRadius`, `startAngle`, `angle`, `cone` can build not only usual cones, but also cone segments. Initially, `upperRadius` will have `0.0` value, `startAngle` - `0f`, `angle` - `PI2`, so if you don't set them, you'll get just a simple cone. From f71130ea0bd700a8dd139ba491d85dd346f1f11e Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:44:44 +0300 Subject: [PATCH 13/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index e8b8a5b0..ba302ff9 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -370,4 +370,4 @@ tube(50, 40, 20, 0f, PI, name = "fragmented tube"){ `extruded` is set by two values: `shape`, and `layer`. * `shape` is a value of `List` type. It's just a list of all points of the solid. *`shape` has to consist of not less than two points!* -* `layer` is `MutableList` types variable. (here is a sentence with description of the work of this function). *The amount of `layer`-s has to be more than one* +* `layer` is `MutableList` types variable. (here is a sentence with a description of the work of this function). *The amount of `layer`-s has to be more than one* From 133de264c11020be5733408a8072ff7fa2225836 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:48:26 +0300 Subject: [PATCH 14/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index ba302ff9..3bdab769 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -222,7 +222,7 @@ It is solid which has six edges. It is set by eight values: `node1`,..., `node8` ![](../docs/images/scheme.png) -As hexagon takes in specific points, we understand that this solid cannot be moved, it fixed in space, and it can't make pivots. +As the hexagon takes in specific points, we understand that this solid cannot be moved, it is fixed in space, and it can't make pivots. Let's make classic parallelepiped. ```kotlin From cb057db93bb3a7306a0a345342da14efd6c5728e Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:48:38 +0300 Subject: [PATCH 15/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 3bdab769..f2c13af0 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -42,7 +42,7 @@ fun main(){ *Basic properties:* 1. `opacity` - It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. 2. `color` - It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. -3. `rotation` - it's the point, which set rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` - pivot around `y axis`, changing `z` - pivot around `z axis`. +3. `rotation` - it's the point, which sets rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` - pivot around `y axis`, changing `z` - pivot around `z axis`. 4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this - vertical `y` axis and horizontal `Oxz` plane. Let's see how properties are set in solids. From 2d6be6629a6f88f59f70ef988410cd43fe6ee735 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:48:56 +0300 Subject: [PATCH 16/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index f2c13af0..fbe064c2 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -114,7 +114,7 @@ fun main(){ ![](../docs/images/two-boxes-1.png) ![](../docs/images/two-boxes-2.png) -***There is plenty of other properties, especially of those, which you can create by yourself. Here we mention just small part.*** +***There is plenty of other properties, especially those, which you can create by yourself. Here we mention just a small part.*** ## Basic Solids Now, let's see which solids can be visualized: From 9c6d646b53cac8037c714c523e69b336eed0c0d0 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:49:11 +0300 Subject: [PATCH 17/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index fbe064c2..3ce8848e 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -125,7 +125,7 @@ It's scarcely a solid, but it can be visualized, so we mention it. `polyline` requires two values - `points`, and `name`: * `points` is a `vararg` with `Point3D` type. It takes pairs of points, which you want to connect. -* `name` is an identifier of *any solid*, but in this case it is an identifier of `polyline`. +* `name` is an identifier of *any solid*; but in this case, it is an identifier of `polyline`. It's type is `String`. **This value can be required by any solid; you can set it, you can not to set it, but without you won't be able to control solid, since it won't be inherited.** From 16c3144b45a767a58784a6865c12751fc9b1d99b Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:49:21 +0300 Subject: [PATCH 18/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 3ce8848e..d21286a9 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -173,7 +173,7 @@ Now, let's make `box` with bigger `y` value. color("black") } ``` -As you can see, only rib of `y-axis` differs from other ribs. +As you can see, only the rib of `y-axis` differs from other ribs. ![](../docs/images/high-box.png) From 84e0211b54ec1f420c989879e1dda1db03747a9e Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:49:37 +0300 Subject: [PATCH 19/21] Update docs/tutorial.md Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index d21286a9..02344e2f 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -177,7 +177,7 @@ As you can see, only the rib of `y-axis` differs from other ribs. ![](../docs/images/high-box.png) -For final trial, let's create `box` with bigger `x` value. +For a final trial, let's create a `box` with a bigger `x` value. ```kotlin box(65, 40, 40, name = "wide box") { From 99c6d0e14ce3c8515db4e1f248c0c8768ed0eee9 Mon Sep 17 00:00:00 2001 From: kiruma524 <71787194+kiruma524@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:56:44 +0300 Subject: [PATCH 20/21] Update tutorial.md --- docs/tutorial.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 02344e2f..8989bd49 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -40,10 +40,10 @@ fun main(){ **We will analyze which basic properties solids have using `box` solid.** *Basic properties:* -1. `opacity` - It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. -2. `color` - It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. -3. `rotation` - it's the point, which sets rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` - pivot around `y axis`, changing `z` - pivot around `z axis`. -4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this - vertical `y` axis and horizontal `Oxz` plane. +1. `opacity` — It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. +2. `color` — It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. +3. `rotation` — it's the point, which sets rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` — pivot around `y axis`, changing `z` — pivot around `z axis`. +4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this — vertical `y` axis and horizontal `Oxz` plane. Let's see how properties are set in solids. The `small box` will have elemental values of properties. If you don't set properties, it will have the same `position`, `color`, `rotation`, and `opacity` values. @@ -123,7 +123,7 @@ Now, let's see which solids can be visualized: It's scarcely a solid, but it can be visualized, so we mention it. `polyline` build lines, obviously. Let's take a look at it's work. -`polyline` requires two values - `points`, and `name`: +`polyline` requires two values — `points`, and `name`: * `points` is a `vararg` with `Point3D` type. It takes pairs of points, which you want to connect. * `name` is an identifier of *any solid*; but in this case, it is an identifier of `polyline`. It's type is `String`. **This value can be required by any solid; @@ -148,15 +148,15 @@ polyline(Point3D(30, 20, 10), Point3D(30, -100, 30), Point3D(30, -100, 30), Poin ### 2) Box First thing which has to be mentioned is that `box` takes four values: `box(x, y, z, name)` -* `x` - x-axis length of the `box` -* `y` - y-axis length of the `box` -* `z` - z-axis length of the `box` +* `x` — x-axis length of the `box` +* `y` — y-axis length of the `box` +* `z` — z-axis length of the `box` These values have `Float` type. *`x`, `y`, and `z` are necessary values, which cannot be ignored. You have to set them.* -* `name` - `box`'es identifier. You've already met it. +* `name` — `box`'es identifier. You've already met it. Let's create just usual `box` with equal ribs. @@ -264,9 +264,9 @@ It takes in six values: `bottomRadius`, `height`, `upperRadius`, `startAngle`, ` Obviously, `bottomRadius` is responsible for the radius of a bottom base, and `height` sets the height of a cone along the `z-axis`. -As it takes such values as `upperRadius`, `startAngle`, `angle`, `cone` can build not only usual cones, but also cone segments. Initially, `upperRadius` will have `0.0` value, `startAngle` - `0f`, `angle` - `PI2`, so if you don't set them, you'll get just a simple cone. +As it takes such values as `upperRadius`, `startAngle`, `angle`, `cone` can build not only usual cones, but also cone segments. Initially, `upperRadius` will have `0.0` value, `startAngle` — `0f`, `angle` — `PI2`, so if you don't set them, you'll get just a simple cone. -Setting `upperRadius`, you make a frustum cone, since it sets a radius of the upper base of a cone. Set `startAngle`, and `angle` let to cut off segments by planes perpendicular to the base. `startAngle` - an angle, starting with which segment will be left, `angle` - an angle of cone, which will be set from `startAngle`. +Setting `upperRadius`, you make a frustum cone, since it sets a radius of the upper base of a cone. Set `startAngle`, and `angle` let to cut off segments by planes perpendicular to the base. `startAngle` — an angle, starting with which segment will be left, `angle` — an angle of cone, which will be set from `startAngle`. Let's build a classic cone: ```kotlin @@ -307,7 +307,7 @@ cone(60, 100, 20, PI*3/4, angle = PI/3, name = "cone") { This solid is set by seven values:`bottomOuterRadius`, `bottomInnerRadius`, `height`, `topOuterRadius`, `topInnerRadius`, `startAngle`, and `angle`. In addition to `height`, `startAngle`, and `angle`, which work as they work in `cone`, there are some new values. -`bottomOuterRadius`, and `bottomInnerRadius` set properties of the bottom circle, `topOuterRadius`, `topInnerRadius` - of the upper circle. They have no initial value, so that means they have to be set. +`bottomOuterRadius`, and `bottomInnerRadius` set properties of the bottom circle, `topOuterRadius`, `topInnerRadius` — of the upper circle. They have no initial value, so that means they have to be set. Generally, `cone`, and `coneSurface` buildings work in the same way, it's possible to make `coneSurface`'s fragments as in `cone` From 623d1e7e3ede7de22c6e87da10e53c1ce3c04da5 Mon Sep 17 00:00:00 2001 From: kiruma524 Date: Fri, 6 Aug 2021 11:26:09 +0300 Subject: [PATCH 21/21] demo renamings --- .../kotlin/space/kscience/visionforge/solid/demo/demo.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt b/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt index 2385fef1..f0235266 100644 --- a/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt +++ b/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt @@ -108,7 +108,7 @@ fun VisionLayout.showcase() { } demo("extrude", "extruded shape") { - extrude { + extruded { shape { polygon(8, 50) }