public Collision(uint entityA, uint?entityB, ColDir direction, CollisionTypes type) { Entity = entityA; CollidedWith = entityB; CollisionDirection = direction; CollisionType = type; }
private void onUpdateView() { Normal = ColDir.Cross(RowDir); createScreenToWorldMatrix(); cacheWorldToScreenVariables(); colDirLength = ColDir.Length(); rowDirLength = RowDir.Length(); this.IsInvalidated = true; }
public void Rotate(Matrix3d rotationMatrix) { ColDir = rotationMatrix * ColDir; RowDir = rotationMatrix * RowDir; colDirLength = ColDir.Length(); rowDirLength = RowDir.Length(); Normal = ColDir.Cross(RowDir); this.onUpdateView(); }
public void ConvertWorldToScreenCoords(double x, double y, double z, Point2d screenCoords) { //get w1 and w2 in screen coordinates (including z) from the top left //s1 = (w1 - tl) * Scale * MMPerPixel; double s1x = (x - tlx) * Scale * MMPerPixel; double s1y = (y - tly) * Scale * MMPerPixel; double s1z = (z - tlz) * Scale * MMPerPixel; screenCoords.X = (s1x * ColDir.X + s1y * ColDir.Y + s1z * ColDir.Z) * colDirLength; screenCoords.Y = (s1x * RowDir.X + s1y * RowDir.Y + s1z * RowDir.Z) * rowDirLength; var dot = ColDir.Dot(RowDir); screenCoords.X = t.X2Ndc(screenCoords.X, FOV.X); screenCoords.Y = t.Y2Ndc(screenCoords.Y, FOV.Y); }