Lathe Geometry in threejs

The lathe geometry class in threejs can be used to create a geometry using an array of 2d points that define a line that is to be repeated along an axis to form a solid shape. For example there is creating an array of vector2 objects that form an arc of a half circle and then using that as a way to form a sphere by passing this array of Vector2 object to the THREE.LatheGeometry constructor along with additional arguments that define the number of segments, and a start and length phi value.

There are all kinds of 3d shapes that can be formed by just coming up with a new 2d path of some kind, and passing it to the lathe geometry constructor. In fact the threejs core built in capsule geometry class is just an extension of the Lathe Geometry class. When it comes to making an array of vector2 objects there is just working out some expressions and helper functions to create the array of THREE.Vector2 objects, or there is using a 2d curve and calling the getPoints method or some other means when working with curves.

Read More

Linux sysbench command for benchmarking a file system

When it comes to using a raspberry PI as a Personal Computer I do end up running into a lot of roadblocks with various things. That is of course to be expected as the Single Board Computers do very much have there limitations. One issue of concern that comes up often seems to be with the read and write speeds of the sd card that is typically used to house the operating system image that is used with the raspberry pi. Often the typical sequential read speeds clock in at around 10MBs, which is still plenty fast sense most of the software used is very light weight to begin with. Still I remember having traditional hard disk speeds that are much faster than that, and this is solid state. This then brings up the question as to if it is possible to get faster disk io pref romance by way of the USB3 Ports of a raspberry pi 4 rather than that of the SD card. With that said if I do have a USB3 drive I would like to test and compare that to a test preformed with the sd card I will need some kind of program to preform such a test such as sysbench

There are a whole lot of other options of course, I see a lot of similar posts on this topic using the dd command as a way to gauge file io for example. One nice thing about using dd is that it is making use of a command that will be there in any flavor of Linux, but it is also limited as it is only good for sequential io testing. When it comes to using something to hold an OS image random io pref romance is of greater interest. Also for those of us that are still new to Linux, or still not as proficient as we would like to be the use of dd can be dangerous if we get careless with it. With that said sysbech can not only do sequential io testing, but also the random io testing that I am more interested in. Also sysbench is useful for testing other components of the raspberry pi such as CPU performance and so forth.

Read More

Tube Geometry in threejs

In threejs there is the base curve class, along with a number of built in options that extend this base curve class to create paths in 2D and also very much 3D space. There are a whole lot of use case examples for these curves such as using them to move objects along a path, or use any point along a curve as a point of reference to have an object look at. However there is also using them to make geometry also by getting an array of Vectors for a 3d curve and then quickly creating a geometry with just a position attribute that will work fine with THREE.Points, or THREE.Line. However things can prove to get a little involved when it comes to making the kind of geometry that will work well with THREE.Mesh. There is working out some kind of project that has to do with using curves as a way to create a custom geometry, however maybe a good starting point for this sort of thing would be to just use the THREE.TubeGeometry class.

As the name suggests this built in geometry constructor will take a 3d curve as the first argument along with several other options arguments to create a geometry that is a kind of tube around a curve. As with many of the other built in options for geometry constructors it will also set up normal and uv attributes as well so one can quickly get up and running with this to create geometry around a curve. Also this kind of geometry can often serve as a nice replacement for THREE.Line or THREE.LineSegements as the full range options and features of mesh materials can be used, and also it can help to address the problem where line width will not always work on all platforms.

Read More

Curve Paths in threejs

There are a number of built in options for extensions of the base curve class of threejs such as CubicBezierCurve3 just to name one. There is also creating ones own curve classes by extending the base curve class as well. These curves can then be used for all sorts of various tasks such as moving an object along the curve, having an object face a point of reference along the curve, creating and updating custom geometries and so forth. So they are great for all kinds of various situations however there is also the idea of having a whole bunch of these curve objects form a single kind of logical curve, and with that this is where curve paths come into play.

Read More

2D Quadratic Bezier Curves in threejs

When it comes to curves in threejs there is the base Curve class, and then there are a number of both 3D as well as 2D curve classes that extend this base curve class. In this post I will be writing about one of the 2D built in options for curves which is the Quadratic Bezier Curve class. This is a kind of curve in which I can give a start point, end point, and a single control point each of which are instances of the Vector2 class. It can be used by itself, or in combination with other options to create a curve path that will then be used in a number of situations in which I need a 2d path.

Read More