added some vector math for membranes processing