mmm-0.1.0.0: Minecraft 1.21.4 implementation in Haskell
Copyright(c) axionbuster 2025
LicenseBSD-3-Clause
Safe HaskellNone
LanguageGHC2021

M.Collision.Internal.March2

Description

Alternative implementation of ray marching algorithm focused on performance.

Synopsis

Documentation

data VHit i a Source #

voxel hit data structure. may encode hit or no hit.

Constructors

VHit 

Fields

  • vhittim :: !a

    finite nonnegative float on hit; otherwise will be positive infinity and there will be no hit (and the other fields will be defined, but meaningless and unspecified)

  • vhitloc :: !(V3 i)

    integer coordinate location of where it hit

  • vhitnor :: !(V3 i)

    the normal vectors (signum; opposite to the displacement)

Instances

Instances details
(Show a, Show i) => Show (VHit i a) Source # 
Instance details

Defined in M.Collision.Internal.March2

Methods

showsPrec :: Int -> VHit i a -> ShowS #

show :: VHit i a -> String #

showList :: [VHit i a] -> ShowS #

(Eq a, Eq i) => Eq (VHit i a) Source # 
Instance details

Defined in M.Collision.Internal.March2

Methods

(==) :: VHit i a -> VHit i a -> Bool #

(/=) :: VHit i a -> VHit i a -> Bool #

isnotahit :: RealFloat a => VHit i a -> Bool Source #

decide if something is not a hit

isahit :: RealFloat a => VHit i a -> Bool Source #

decide if something is a hit

march Source #

Arguments

:: (RealFloat a, Integral i, Monad m) 
=> (V3 i -> m Bool)

test for stoppage (True to stop)

-> V3 a

direction, any physical dimension

-> V3 a

initial position, dimensionless

-> Int

number of iterations (maximum)

-> m (VHit i a)

hit information (success or failure)

march along an integer grid using a digital differential analyzer (DDA)-based algorithm