Skip to content

Commit

Permalink
add Ray zero [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
islent committed Aug 18, 2024
1 parent a09ad18 commit 59d73a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PhysicalMeshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end
end

import Core: Number
import Base: +, -, *, /, show, real, length, iterate, intersect
import Base: +, -, *, /, show, real, length, iterate, intersect, zero, iszero
import Unitful: Units, FloatTypes
#import Decimals: Decimal, decimal
import PhysicalParticles: PVector2D, PVector, area, volume, mass_center
Expand Down
6 changes: 6 additions & 0 deletions src/Ray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Ray2D(n::PVector2D{T}) where T<:Number = Ray2D(PVector2D(T), n, atan(n.y, n.x))
Ray2D(x::PVector2D{T}, theta::Number) where T<:Number = Ray2D(x, PVector2D(T(sin(theta)), T(cos(theta))), theta)
Ray2D(theta::Number) = Ray2D(PVector2D(), PVector2D(sin(theta), cos(theta)), theta)

zero(r::Ray2D) = Ray2D(r.x, zero(r.n), zero(r.x.x))
iszero(r::Ray2D) = iszero(r.n)

"""
$(TYPEDEF)
$(TYPEDFIELDS)
Expand All @@ -29,6 +32,9 @@ struct Ray3D{T<:Number} <: AbstractRay3D{T}
n::PVector{T}
end

zero(r::Ray3D) = Ray3D(r.x, zero(r.n), zero(r.x.x))
iszero(r::Ray3D) = iszero(r.n)

### Ray2D reflect from Line2D
"""
$(TYPEDSIGNATURES)
Expand Down

0 comments on commit 59d73a6

Please sign in to comment.