Wow, I’m sorry this has been lying around for so long without a single answer. I’ll give it a shot, even though you’ve hopefully managed to get past these problems already.
To start with, are you using some kind of point type, or just regular Julia arrays, to represent the point? If you’re using regular Julia arrays, you could probably use built-in functions like dot and norm to accomplish what you’re trying to do. For example, to project a vector a onto a vector b, you can use the formula a_2 = dot(a,b) / norm(b)^2 * b (it, and many others, are available on Wikipedia <http://en.wikipedia.org/wiki/Vector_projection>). If you’re using your own (or someone elses) point type, you could use exactly the same approach, if you first extend the dot and norm functions with methods for your point type: immutable Point2D{T<:Real} x::T y::T end import Base: dot, norm dot{T<:Real}(a::Point2D{T}, b::Point2D{T}) = a.x * b.x + a.y * b.y norm{T<:Real}(a::Point2D{T}) = sqrt(dot(a,a)) If one or more of these concepts are utterly unfamiliar to you, I’d recommend giving the manual a read-through <http://docs.julialang.org/en/release-0.3/> - I haven’t used anything that isn’t extensively explained either there or in the Wikipedia article I linked to above =) Happy hacking! // Tomas On Wednesday, January 14, 2015 at 9:05:18 AM UTC+1, tmjohari wrote: Hi, > I am very new to Julia Programming. > > Is there a package/easy way to project a point onto a constraint > line/plane, or > at least calculate the distance(maybe euclidean distance) between the > point and constraint plane/line and move the point later on by adding the > distance(later changed to vector) to the point? >
