Calculator Sample
The Calculator sample demonstrates usage of DG Kernel component as a
geometric calculations engine, which does not have to have a visible user
interface.
The applications performs three different types of calculations related to an
arbitrary three dimensional ray represented with ILine
interface
See also: All Visual Basic samples,
All samples
Running the application
The Line groups of controls allows modification of location and direction of
the line (ray). The application solves three different problems:
- 1. Calculation of rotation of a 3D point around the line
- 2. Calculation of interentity point of the line with an arbitrary plane
- 3. Calculation of distance from a 3D point to the line and calculation of the nearest point.
-
- Selection of the current problem is made in the Operation group of
controls.
Depending on the current problem the Input/Point group allows entering either
location of the initial point or position of the plane. When Interentity option
is selected Input group contains Normal group, which allows changing orientation
of normal of the plane.
Implementation
The above calculations are performed with the help of ILineGeom
interface. ILineGeom
is obtained from ILine
interface in Form_Load Sub. ILine
itself is created as a new object independent of any 3D view with the help of Object
Generator, instance of which is created using its Program ID and
CreateObject API.
Location and direction of the line is modified via ILine/a>
interface stored in a form variable.
|