pygae / mpl_toolkits.clifford

Matplotlib extensions for clifford compatibility
MIT License
11 stars 2 forks source link

Why the showing results of mpl_toolkits and pyganja are different? #6

Open HubChangWang opened 4 years ago

HubChangWang commented 4 years ago
from clifford.g3c import *
from matplotlib import pyplot as plt
import mpl_toolkits.clifford
from math import *
from pyganja import GanjaScene, draw
import pyganja; pyganja.__version__

plt.ioff()  # we'll ask for plotting when we want it
from clifford.tools import classify as cla
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1, projection='3d')

point = up(0.2 * e1 + 0.3 * e2 + 0.5 * e3)
point1 = up(0.2 * e1 + 0.3 * e2 + 0.8 * e3)
S1 = point - 0.1 * einf
S2 = point1 - 0.1 * einf
circle2 = S1 ^ S2
plane=((circle2.dual())^einf)

sc = GanjaScene()
sc.add_object(circle2.dual(), color=(128, 0, 0), label='plane')
sc.add_object(plane, color=(0, 0, 100), label='point')
draw(sc)

mpl_toolkits.clifford.plot(ax1, [circle2.dual()], color='tab:blue')
mpl_toolkits.clifford.plot(ax1, [plane], color='tab:red')
fig.tight_layout()
# show the figure
plt.show()
hugohadfield commented 4 years ago

Hi there, looks like this is a normalisation issue. If you change mpl_toolkits.clifford.plot(ax1, [circle2.dual()], color='tab:blue') mpl_toolkits.clifford.plot(ax1, [plane], color='tab:red') to mpl_toolkits.clifford.plot(ax1, [circle2.dual().normal()], color='tab:blue') mpl_toolkits.clifford.plot(ax1, [plane.normal()], color='tab:red') you will get the correct visualisation.

@eric-wieser does the mpl_toolkit do normalisation before extraction of objects parameters etc? If not we should probably add it

eric-wieser commented 4 years ago

I think the issue lies in the (lack of) epsilon handling in clifford.tools.classify, not this package

HubChangWang commented 4 years ago

Hi there,@hugohadfield @eric-wieser, thank you for your advice, problem solved by adding the .normal() method.