octadist.linear

octadist.src.linear.angle_sign(v1, v2, direct)[source]

Compute angle between two vectors with sign and return value in degree.

Parameters:
  • v1 (array_like) – Vector in 3D space.
  • v2 (array_like) – Vector in 3D space.
  • direct (array) – Vector that refers to orientation of the plane.
Returns:

angle (float64) – Angle between two vectors in degree unit with sign.

See also

calc.calc_theta()
Calculate theta parameter.

Examples

>>> vector1 = [1.21859514, -0.92569245, -0.51717955]
>>> vector2 = [1.02186387,  0.57480095, -0.95220433]
>>> direction = [1.29280503, 0.69301873, 1.80572438]
>>> angle_sign(vector1, vector2, direction)
60.38697927455357
octadist.src.linear.angle_btw_vectors(v1, v2)[source]

Compute angle between two vectors and return value in degree.

Parameters:
  • v1 (array_like) – Vector in 3D space.
  • v2 (array_like) – Vector in 3D space.
Returns:

angle (float64) – Angle between two vectors in degree unit.

Examples

>>> vector1 = [-0.412697, -0.357008, -1.788172]
>>> vector2 = [-0.550839,  1.799178, -0.039114]
>>> angle_btw_vectors(vector1, vector2)
95.62773246517462
octadist.src.linear.angle_btw_planes(a1, b1, c1, a2, b2, c2)[source]

Find the angle between 2 planes in 3D and return value in degree.

General equation of plane:

a*X + b*Y + c*Z + d = 0
Parameters:
  • b1, c1 (a1,) – Coefficient of the equation of plane 1.
  • b2, c2 (a2,) – Coefficient of the equation of plane 2.
Returns:

angle (float64) – Angle between 2 planes in degree unit.

Examples

>>> # Plane 1
>>> a1 = -3.231203733528
>>> b1 = -0.9688526458499996
>>> c1 = 0.9391692927779998
>>> # Plane 2
>>> a2 = 1.3904813057000005
>>> b2 = 3.928502357473003
>>> c2 = -4.924114034864001
>>> angle_btw_planes(a1, b1, c1, a2, b2, c2)
124.89920902358416
octadist.src.linear.triangle_area(a, b, c)[source]

Calculate the area of the triangle using the cross product:

Area = abs(ab X ac)/2

where vector ab = b - a and vector ac = c - a.
Parameters:
  • a (array_like) – 3D Coordinate of point.
  • b (array_like) – 3D Coordinate of point.
  • c (array_like) – 3D Coordinate of point.
Returns:

area (float64) – The triangle area.

Examples

>>> # Three vertices
>>> a = [2.298354000, 5.161785000, 7.971898000]
>>> b = [1.885657000, 4.804777000, 6.183726000]
>>> c = [1.747515000, 6.960963000, 7.932784000]
>>> triangle_area(a, b, c)
1.7508135235821773