DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Go to DGKC docs Search Documentation


Collision Path VB .NET Sample

Description

Implementation

The most important functionality is contained in OnAnimate() handler of the Animate button, where IMetrics of objects in the model are added to Kinematic Set,, which is a collection of object participated in the detection.

The m_tCollision = m_iDetector.Detect(context) line performs the collision detection and stores collision time in m_tCollision data member. It will be a large number if there where no collision.

m_iDetector object is created on start of the application in OnFormLoad sub.using IDIObjGenerator.Create( EObjectType.eObjTypePathCollisionDetector ) (See IDIObjGenerator.Create)

OnFormLoad sub also creates new Movement objects and an auxiliary frame object, which will be used to set / retrieve frames from frame array in various parts of the program.

SetupDefaultMovement() sub, also called from OnFormLoad, defines the initial moment paths for each object. The first object (Cylinder) is translated up by 1 and then is translated to the right (along x axis) by 3 with rotation around its local y axis. The second object (Cone) remains in the same position, but rotates by 45 degrees during the second half of the movement.

Notice also m_iKinematicSet.SetPosition(m_t) call inside OnTimer handler of timer events, which moves all objects to their position at the moment m_t.

The current frame is rendered in OnClientDraw() with m_iGraphicItemFrame.Draw(). m_iGraphicItemFrame is a IGraphicItem implemented by Graphic Item of the standalone frame m_iFrame. It is created in CreateFrameGraphicItem().