Skip to content

Commit

Permalink
Update python examples
Browse files Browse the repository at this point in the history
Signed-off-by: Franco Cipollone <franco.c@ekumenlabs.com>
  • Loading branch information
francocipollone committed Aug 19, 2021
1 parent a419f3c commit c54755f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
26 changes: 13 additions & 13 deletions examples/angle_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@

import ignition.math

print("PI in degrees = {}\n".format(ignition.math.Angle.Pi.Degree()))
print("PI in degrees = {}\n".format(ignition.math.Angle.PI.degree()))

a1 = ignition.math.Angle(1.5707)
a2 = ignition.math.Angle(0.7854)
print("a1 = {} radians, {} degrees\n".format(a1.Radian(), a1.Degree()))
print("a2 = {} radians, {} degrees\n".format(a2.Radian(), a2.Degree()))
print("a1 * a2 = {} radians, {} degrees\n".format((a1 * a2).Radian(),
(a1 * a2).Degree()))
print("a1 + a2 = {} radians, {} degrees\n".format((a1 + a2).Radian(),
(a1 + a2).Degree()))
print("a1 - a2 = {} radians, {} degrees\n".format((a1 - a2).Radian(),
(a1 - a2).Degree()))
print("a1 = {} radians, {} degrees\n".format(a1.radian(), a1.degree()))
print("a2 = {} radians, {} degrees\n".format(a2.radian(), a2.degree()))
print("a1 * a2 = {} radians, {} degrees\n".format((a1 * a2).radian(),
(a1 * a2).degree()))
print("a1 + a2 = {} radians, {} degrees\n".format((a1 + a2).radian(),
(a1 + a2).degree()))
print("a1 - a2 = {} radians, {} degrees\n".format((a1 - a2).radian(),
(a1 - a2).degree()))

a3 = ignition.math.Angle(15.707)
print("a3 = {} radians, {} degrees\n".format(a3.Radian(), a3.Degree()))
a3.Normalize()
print("a3.Normalize = {} radians, {} degrees\n".format(a3.Radian(),
a3.Degree()))
print("a3 = {} radians, {} degrees\n".format(a3.radian(), a3.degree()))
a3.normalize()
print("a3.Normalize = {} radians, {} degrees\n".format(a3.radian(),
a3.degree()))
14 changes: 7 additions & 7 deletions examples/vector2_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
vb = ignition.math.Vector2d(3, 4)
vc = ignition.math.Vector2d(vb)

print("va = {} {}\n".format(va.X(), va.Y()))
print("vb = {} {}\n".format(vb.X(), vb.Y()))
print("vc = {} {}\n".format(vc.X(), vc.Y()))
print("va = {} {}\n".format(va.x(), va.y()))
print("vb = {} {}\n".format(vb.x(), vb.y()))
print("vc = {} {}\n".format(vc.x(), vc.y()))

vb += va
print("vb += va: {} {}\n".format(vb.X(), vb.Y()))
print("vb += va: {} {}\n".format(vb.x(), vb.y()))

vb.Normalize()
print("vb.Normalize = {} {}\n".format(vb.X(), vb.Y()))
vb.normalize()
print("vb.normalize = {} {}\n".format(vb.x(), vb.y()))

print("vb.Distance(va) = {}\n".format(vb.Distance(va)))
print("vb.distance(va) = {}\n".format(vb.distance(va)))
8 changes: 4 additions & 4 deletions examples/vector3_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import ignition.math

v1 = ignition.math.Vector3d(0, 0, 3)
print("v =: {} {} {}\n".format(v1.X(), v1.Y(), v1.Z()))
print("v =: {} {} {}\n".format(v1.x(), v1.y(), v1.z()))

v2 = ignition.math.Vector3d(4, 0, 0)
print("v2 = {} {} {}\n".format(v2.X(), v2.Y(), v2.Z()))
print("v2 = {} {} {}\n".format(v2.x(), v2.y(), v2.z()))

v3 = v1 + v2
print("v1 + v2 = {} {} {}\n".format(v3.X(), v3.Y(), v3.Z()))
print("v1 + v2 = {} {} {}\n".format(v3.x(), v3.y(), v3.z()))

print("v1.Distance(v2) = {}\n".format(v1.Distance(v2)))
print("v1.Distance(v2) = {}\n".format(v1.distance(v2)))

0 comments on commit c54755f

Please sign in to comment.