Author Topic: Vector Drawing at XY Oscilloscope Screen at Constant Speed  (Read 1770 times)

0 Members and 1 Guest are viewing this topic.

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6268
  • Country: fi
    • My home page and email address
Re: Vector Drawing at XY Oscilloscope Screen at Constant Speed
« Reply #25 on: March 30, 2024, 07:31:39 pm »
Concerning 3d display calculations back then, I had issues with determining 3d to 2d visibility with random objects in a display list.
The best solution for that is a z-buffer, ie. recording the distance from camera/focal point/display plane to object surface, for each pixel separately.  Current GPU hardware supports this natively.  The trick is to scale the z coordinates so that most of the precision is used for the visually important range, to avoid the jaggies.  That's why it is called a view frustum, and not view pyramid or view cone.

For 3D line vector graphics, there are a lot of tricks, for example decomposing objects into convex parts.

Funny thing is, if you first rotate and translate your word so that the projection plane is centered on the Z axis, perpendicular to the Z axis, with positive X axis right, and camera or eye at origin, the math simplifies a lot for both 3D line/vector graphics, and for raytracing/raycasting.

For example, if you enclose your objects in spheres (center at \$(x_s, y_s, z_s)\$), and \$(x_n, y_n, z_n)\$ is the unit normal vector (\$x_n^2 + y_n^2 + z_n^2 = 1\$) of a plane passing through origin, the signed distance between the sphere center and the plane is \$x_n x_s + y_n y_s + z_n z_s\$.  If that is greater than the sphere radius \$r_s\$, the entire sphere and thus the object is above the plane.
If you do this test for the four planes defining the view frustum (edges of the projected 2D view rectangle) excluding the planes perpendicular to Z axis, normal vectors pointing outwards, if the sphere is above any of the planes the object is outside the view frustum and none of it is drawn.  The Z-axis tests are just comparing the Z coordinate of the sphere center, of course.

One of my hobby projects is visualizing atomic and molecular systems by rendering (raytracing or raycasting) atoms as spheres, optionally with bonds as cylinders ("ball-and-sticks models"), overlaid with edges and intersections described as 2D curves.  The SVG file format is perfect for this.  The point is to get optimal publication quality, crisp images, while keeping the actual file size manageable.  With cel shading and varying the edge thickness/darkness/"strength" based on the distance to the background object at the edge, you can make complex structures visually intuitive and obvious.  (Instead of striving for "photographic quality" as if atoms were hard spheres, this leverages human perception and effects developed in visual arts to control the information conveyed by the image.)  Very nice for large complex proteins, visualizing ion/cluster implantation (by omitting the target atoms not affected by the implantation), and so on.

I collected the most important intersection test equations needed for this in my user page at Wikipedia in 2010.
 
The following users thanked this post: SiliconWizard


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf