public void SetupAnimationForLinearInterpolation(FullWrist wrist, int startPosition, int endPosition, int startFixedBoneIndex, int endFixedBoneIndex, int numSteps) { Bone startFixedBone = wrist.Bones[startFixedBoneIndex]; Bone endFixedBone = wrist.Bones[endFixedBoneIndex]; if (!startFixedBone.IsValidBone || !endFixedBone.IsValidBone) { throw new ArgumentException("Cannot set fixed bone to a non-valid bone"); } _boneTransforms = new TransformMatrix[WristFilesystem.NumBones][]; for (int i = 0; i < WristFilesystem.NumBones; i++) { if (!wrist.Bones[i].IsValidBone) { continue; } Bone bone = wrist.Bones[i]; _boneTransforms[i] = bone.CalculateInterpolatedMotion(startPosition, endPosition, startFixedBone, endFixedBone, numSteps); } _fullWrist = wrist; _numberOfFrames = numSteps; _endPositionIndex = endPosition; _endFixedBoneIndex = endFixedBoneIndex; }
private void ProcessContoursMultiThreaded(FullWrist fullWrist, int refBoneIndex, int testBoneIndex, int[] posList) { Queue <Queue <BulkCalculator.DistanceCalculationJob> > q; q = BuildMasterQueue(fullWrist, refBoneIndex, testBoneIndex, posList, _cDistances); //go compute this! BulkCalculator calculator = new BulkCalculator(); calculator.ProcessMasterQueue(q); }
private void ProcessContoursSingleThread(FullWrist fullWrist, int refBoneIndex, int testBoneIndex, int[] posList) { Bone refBone = fullWrist.Bones[refBoneIndex]; Bone testBone = fullWrist.Bones[testBoneIndex]; for (int i = 0; i < posList.Length; i++) { int pos = posList[i]; refBone.CalculateAndSaveDistanceMapForPosition(pos, new Bone[] { testBone }); refBone.CalculateAndSaveContourForPosition(pos, _cDistances, GetWhiteColors(_cDistances.Length)); } }
private void ReadInJobFromOption() { PreliminaryValidation(_options); _side = WristFilesystem.GetSideFromString(_options.SideString); _wrist = new WristFilesystem(WristFilesystem.findRadius(_options.Subject, _side)); _fullWrist = new FullWrist(_wrist); _refBoneIndex = _options.GetReferenceBoneIndex(); _testBoneIndex = _options.GetTestBoneIndex(); //int fixedBoneIndex = options.GetFixedBoneIndex(); _positionList = GetPositionIndexes(_wrist, _options.GetPositionNames()); _cDistances = _options.GetCoutourDistances(); _cAreas = _options.GetTargetContourAreas(); }
private void loadFullWrist(string radiusFilename) { //TODO: ShowFullWristControlBox //TODO: Block viewSource //First Try and load the wrist data _wrist = new WristFilesystem(); _wrist.setupWrist(radiusFilename); _fullWrist = new FullWrist(_wrist); _fullWrist.LoadFullJoint(); _root = _fullWrist.Root; populateSeriesList(); //TODO? //catch (ArgumentException ex) //{ // if (_showErrors) // { // string msg = "Error loading wrist kinematics.\n\n" + ex.Message; // //TODO: Change to abort,retry, and find way of cancelling load // libWrist.ExceptionHandling.HandledExceptionManager.ShowDialog(msg, "", "", ex); // } // for (int i = 0; i < Wrist.NumBones; i++) // _wristControl.disableFixingBone(i); //} //disable invalid bones! for (int i = 0; i < WristFilesystem.NumBones; i++) { if (!_fullWrist.Bones[i].IsValidBone) { _wristControl.disableBone(i); } } setupPositionGraphIfPossible(8); //hardcoded default reference bone to the Capitate }
private static Queue <Queue <BulkCalculator.DistanceCalculationJob> > BuildMasterQueue(FullWrist fullWrist, int refBoneIndex, int testBoneIndex, int[] posList, double[] cDistances) { Queue <Queue <BulkCalculator.DistanceCalculationJob> > masterQueue = new Queue <Queue <BulkCalculator.DistanceCalculationJob> >(2); Queue <BulkCalculator.DistanceCalculationJob> q = new Queue <BulkCalculator.DistanceCalculationJob>(); for (int i = 0; i < posList.Length; i++) { BulkCalculator.DistanceCalculationJob job = new BulkCalculator.DistanceCalculationJob(); job.JobType = BulkCalculator.DistanceCalculationType.VetrexDistances; job.FullJoint = fullWrist; job.PrimaryBone = fullWrist.Bones[refBoneIndex]; job.IneractionBones = new Bone[] { fullWrist.Bones[testBoneIndex] }; job.PositionIndex = posList[i]; job.AnimationOrder = null; q.Enqueue(job); } masterQueue.Enqueue(q); q = new Queue <BulkCalculator.DistanceCalculationJob>(); for (int i = 0; i < posList.Length; i++) { BulkCalculator.DistanceCalculationJob job = new BulkCalculator.DistanceCalculationJob(); job.JobType = BulkCalculator.DistanceCalculationType.Contours; job.FullJoint = fullWrist; job.PrimaryBone = fullWrist.Bones[refBoneIndex]; job.ContourDistances = cDistances; job.ContourColors = GetWhiteColors(cDistances.Length); job.PositionIndex = posList[i]; job.AnimationOrder = null; q.Enqueue(job); } masterQueue.Enqueue(q); return(masterQueue); }