Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This is a vast Mathematical Module which is extremely user-friendly. The module deals with 3-dimensional objects, namely Point, Line and Plane. Using this module, the 3D algebra of Points, Lines and Planes can be easily performed in python.
A lot of help text is included in each class, and in the error messages, hence making the module easy to use.
This module is dependent upon another of my own modules, namely 'pyvectors' without which, this module cannot be used upto its full capacity. For example, Vectors are needed in 3-dimensions to determine the difference between two Points, to determine the direction of a Line, to determine the normal to a Plane and so on. Users are advised to familiarize themselves with pyvectors in order to use pygeo3d effectively.
Point(x, y, z) -> xi + yj + zk
represents the Position Vector of a Point in 3D space
x, y and z are the Cartesian co-ordinates of the Point
Line(Point(x1, y1, z2), Vector(x2, y2, z2)) -> r = (x1i + y1j + z1k) + u(x2i + y2j + z2k)
represents the Vector Equation of a Line in 3D space
(a := Point(x1, y1, z1)) is a Point on the Line and (b := Vector(x2, y2, z2)) is a Vector parallel to the Line
Plane(Vector(x, y, z), d) -> r.(xi + yj + zk) = d
represents the Vector Equation of a Plane in 3D space
(n := Vector(x, y, z)) is a Vector normal to the Plane and d is the constant in the equation of the Plane
Point can be indexed by the strings ("x", "y", "z") which return the x, y and z co-ordinate of the Point respectively
ex: Point(2, -3, 5)["y"] -> -3
defined as the distance of the Point from Origin (0, 0, 0)
can be achieved through abs(Point(x, y, z))
returns the Point obtained when given Point is moved along a Vector
can be achieved through (p + v)
returns the Vector joining the given Points p1 and p2
can be achieved through p2 - p1 (with tip at p2 and tail at p1)
returns a tuple (x, y, z) containing the co-ordinates of the Point
returns the octant in which the given Point lies (1 - 8)
returns the axis on which the given Point lies (1 - 3)
Line can be indexed by Real Numbers (int / float) which return the Point located on the Line at the parameter value equal to the given index
ex: Line(Point(1, 2, -4), Vector(2, -1, -1))[2] -> Point(5, 0, -6)
ex: Line(Point(1, 2, -4), Vector(2, -1, -1))[-2.5] -> Point(4, 4.5, -1.5)
left operand - Point
returns True if the Point lies on the Line and False in all other cases
returns a tuple (cosA, cosB, cosC) containing the direction cosines of the Line
returns a tuple wherein the direction ratios of the Line are scaled by a factor 'n'
returns a tuple of Points on the Line from index k1 to index k2 (including k1 and excluding k2) separated by value step
left operand - Point / Line
returns True if the Point lies on / the Line is contained in the Plane and False in all other cases
returns a str of representation of the Plane in Cartesian form
returns a str of representation of the Plane in terms of its unit normal Vector and its distance from the Origin (0, 0, 0)
Each of these objects can be constructed alternatively by the following classmethods:
creates a Point whose co-ordinates are taken from the given list, tuple or dict
to pass a dict as an argument, appropriate keys ("x", "y", "z") must be used
creates the unique Point associated with the given Position Vector
using Vector(x, y, z) as an argument results in the Point(x, y, z)
creates a Line inclined to the co-ordinate axes at the given angles passing through the given Point
creates a Line passing through two unique Points
creates a Plane with normal Vector n, passing through the given Point
creates a Plane passing through three unique non-collinear Points
creates a Plane containing the two unique non-skew Lines
creates a Plane through the Line of intersection of the given Planes passing through the given Point
creates a Plane containing the given Line passing through the given Point
And many more... Each function contains help text that can be accessed through help() in python to know more about it. Users are advised to read help() on methods they want to use to ensure required results.
Many methods are provided for the user to plot and visualize 3-dimensional Points, Lines, Planes, Line Segments and Vectors. In order, these are:
plots single Point
plots multiple Points on the same grid
plots single Line
plots multiple Lines on the same grid
plots single Plane
plots multiple Planes on the same grid
plots the Line Segment joining two unique Points
plots any number of 3D objects on the same grid
to refer to a Line Segment, pass a tuple of two unique Points
plot_intersections is a boolean which if True, plots the objects along with their Points / Lines of intersection (if any)
plots given number of each 3D object (chosen randomly) on the same grid
plots single Vector
plots multiple Vectors on the same grid
Notes:
returns the shortest Euclidean distance between two Points, Lines, Planes or any combination thereof
returns the acute angle between two Lines, Planes or any combination thereof
returns True if all given Lines and Planes are parallel to each other and False in all other cases
returns True if two Lines, Planes and or combination thereof are perpendicular and False in all other cases
returns the Point which divides the Line Segment joining p1 and p2 in the ratio m : n internally by default
returns the midpoint of the Line Segment joining p1 and p2
returns the area of the triangle formed by p1, p2 and p3
returns the centroid of the triangle formed by p1, p2 and p3
returns True if all given Points are collinear and False in all other cases
returns True if all given Points are coplanar and False in all other cases
And many more... Each function contains help text that can be accessed through help() in python to know more about it. Users are advised to read help() on methods they want to use to ensure required results.
Line objects now support slicing - which returns a tuple of Points on the Line at the indices given in the slice
for example:
Line(Point(1, -2, 3), Vector(-2, 4, -1))[-1.5:1:0.5] -> (Point(-2, 4, 1.5), Point(-1, 2, 2), Point(0, 0, 2.5), Point(1, -2, 3), Point(2, -4, 3.5))
Feel free to reach out to me if you notice any bugs or if you need any kind of help from me in understanding the usage of the module or the source code. My email: knightt1821@gmail.com
FAQs
provides a 3D co-ordinate system using Vectors in Python
We found that pygeo3d demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.