kbwbe wrote: ↑Sat Jul 28, 2018 4:08 pm
Branch "solver-stabilization" has been updated again.
Rigid.calcSpinCenter() is fixed.
Also some improvements for project-folder stuff are done. So project folder option is usable for different operation systems.
Hi,
Didn't have much time this weekend, but I'm playing with the code a bit and I think I don't understand how do I get that result...
My calcSpinCenter code looks like that (with added printouts):
Code: Select all
def calcSpinCenter(self):
newSpinCenter = Base.Vector(0,0,0)
countRefPoints = 0
for dep in self.dependencies:
if dep.refPoint != None:
newSpinCenter = newSpinCenter.add(dep.refPoint)
FreeCAD.Console.PrintMessage("{} - Ref point: {}, new center {}\n".format(self.label, dep.refPoint, newSpinCenter))
countRefPoints += 1
if countRefPoints > 0:
newSpinCenter.multiply(1.0/countRefPoints)
FreeCAD.Console.PrintMessage("{} - Spin center: {} num of points: {}\n".format(self.label, self.spinCenter, countRefPoints))
Here's an object with 2 dependencies and the vector values from the printouts:
Code: Select all
big-plate_001 - Ref point: Vector (50.0, 150.0, 20.0), new center Vector (50.0, 150.0, 20.0)
big-plate_001 - Ref point: Vector (150.0, 50.0, 20.0), new center Vector (200.0, 200.0, 40.0)
big-plate_001 - Spin center: Vector (200.0, 100.0, 10.0) num of points: 2
Both refPoints are on the same level of the Z afix (value 20.0)
I would expect to see the result's Z axis value to be 20 as well and not 10...
So we should be looking on 2D middle point in that case...
The X value is not logical as well...
What am I missing here?
Maybe we should calculate the averages for every axis separately and not using multiply?