what is objs in the method that follow? I have tried to set
GLScatterPlotItem, GLviewWiget, but i gotan error : objet is not iterable ,
and i don't know why !
What value objs can take ?
Thanks
the method is :
def plotGLPlot(self, objs): # new commentaire : add item -> plot 3D point
poss = numpy.array([0, 0, 0])
self.Poss = []
self.GlobalInds = []
weights = numpy.array(0, dtype=float)
def pswc (x) : return 10 * x**0.25 #pseudoweight calculation with
exponential scaling
for obj in objs:
for i,cogs in enumerate(obj.CoG):
for cog in cogs:
#cog[1] = 0
if obj.PieceWeight[i]:
poss = numpy.vstack([poss,numpy.asarray(cog.T)])
self.Poss.append(numpy.matrix(cog.T)) # for picking
stuff
self.GlobalInds.append(obj.Index[i])
pw = pswc(obj.PieceWeight[i])
print("PieceWeight : "+str(pw))
weights = numpy.append(weights, pw)
maxw = max(weights)
threshold = numpy.mean(weights)
self.Colors = numpy.empty([len(weights),4])
for i, pw in enumerate(weights):
if pw <= threshold:
c = pw / maxw
self.Colors[i] = numpy.array([c,1,0,0.7])
else:
c = 1 - pw / maxw
self.Colors[i] = numpy.array([1,c,0,0.7])
self.removeItem(self.Plot)
#....self.Plot = gl.GLScatterPlotItem()
#.....self.Plot.setData(pos=poss, size=weights, color=self.Colors,
pxMode=False)
self.Sizes = weights
#....self.addItem(self.Plot)
self.show()
Le jeudi 18 juin 2015 23:35:18 UTC+2, Bi Ge a écrit :
>
> Hi folks,
>
> I would like to pick a point in a 3D scatter plot. I read from Luke's post
> here:
>
> "
> This version also has methods for determining the projection and view
> matrices, which allows you to determine the relationship between 3D and 2D
> manually:
>
> m = glView.projectionMatrix() * glView.viewMatrix()
>
> # Map 3D location to normalized device coordaintes: (-1,-1) and (1,1) are
> opposite corners of the view
> pt = m.map(QtGui.QVector3D(x,y,z))
>
> # Inverse mapping:
> pt = m.inverted()[0].map(QtGui.QVector3D(x,y,z))
>
>
> "
>
> My questions are:
> 1. Does inverse mapping meaning from 2D to 3D? If so, why does the map
> take a 3D vector when the point on screen is only 2D:
>
> 2. After apply inverse mapping on a point on the screen, we get a
> point(vector) in 3D and from here I just need to cast a ray and find where
> it hits the point I want to find correct?
>
> Bi
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/438f1126-2c7c-46d8-8a83-7355185ef91fo%40googlegroups.com.