public static float ComputeFDistribution(Module module, Pose pose, ParallelQuery <BoundingSphere> allSpheres) { BoundingSphere updatedBoundingSphere = Module.GetBoundingSphere(module, module.furthestA, module.furthestA, pose); float fCollision = IntersectionUtil.GetVolumeOfIntersection(updatedBoundingSphere, allSpheres); Vector3 rot = pose.rotation.eulerAngles * Deg2Rad; Vector3 tropismAngle = module.plant.plantConfig.tropismEulerAngles * Deg2Rad; float fTropism = Vector3.Magnitude( new Vector3(Cos(tropismAngle.x), Cos(tropismAngle.y), Cos(tropismAngle.z)) - new Vector3(Cos(rot.x), Cos(rot.y), Cos(rot.z))); return(module.plant.plantConfig.weightCollisions * fCollision + module.plant.plantConfig.weightTropism * fTropism); }
public static float CalculateLight(BoundingSphere node, ParallelQuery <BoundingSphere> allNodes) { return(Exp(-IntersectionUtil.GetVolumeOfIntersection(node, allNodes))); }