Esempio n. 1
0
        Quaternion centerData(Quaternion q1, Quaternion q2)
        {
            WindowsQuaternion q1w = convertToWindowsQuaternion(q1);
            WindowsQuaternion q2w = convertToWindowsQuaternion(q2);

            WindowsQuaternion conj   = WindowsQuaternion.Conjugate(q1w);
            WindowsQuaternion center = WindowsQuaternion.Multiply(conj, q2w);

            return(convertToQuaternion(center));
        }
Esempio n. 2
0
        private void Update(EvaluationContext context)
        {
            var sourcePoints      = SourcePoints.GetValue(context) as StructuredList <Point>;
            var destinationPoints = DestinationsPoints.GetValue(context) as StructuredList <Point>;

            if (sourcePoints == null || destinationPoints == null ||
                sourcePoints.NumElements == 0 || destinationPoints.NumElements == 0)
            {
                _pointList.SetLength(0);
                ResultList.Value = _pointList;
                return;
            }

            var count = sourcePoints.NumElements * destinationPoints.NumElements;

            if (_pointList.NumElements != count)
            {
                _pointList.SetLength(count);
            }

            for (var destinationIndex = 0; destinationIndex < destinationPoints.NumElements; destinationIndex++)
            {
                var destination = destinationPoints.TypedElements[destinationIndex];

                for (var sourceIndex = 0; sourceIndex < sourcePoints.NumElements; sourceIndex++)
                {
                    var source = sourcePoints.TypedElements[sourceIndex];
                    _pointList.TypedElements[destinationIndex * sourcePoints.NumElements + sourceIndex]
                        = new Point()
                        {
                        Position    = destination.Position + Vector3.Transform(source.Position, destination.Orientation),
                        W           = source.W,
                        Orientation = Quaternion.Multiply(destination.Orientation, source.Orientation),
                        };
                }
            }

            ResultList.Value = _pointList;
        }