How to calculate the points after transformation

I tried the following code and the result is quite different from my data.

code:

ofstream OutCsv_LowerPartPts("DirectlyExportLowerPartPointsAfterTrans.csv",ios_base::out|ios_base::trunc);

          OutCsv_LowerPartPts<<"step"<<","<<"time"<<","<<

                    "p1-x"<<","<<"p1-y"<<","<<"p1-z"<<","<<""<<","<<

                    "p2-x"<<","<<"p2-y"<<","<<"p2-z"<<","<<""<<","<<

                    "p3-x"<<","<<"p3-y"<<","<<"p3-z"<<","<<"\n";

          int nSteps = 1;

          //1. Calculate the first Group of Parameters.

          while (iSMotionExactTime

          {

                    

                    iSwMotionStudy->SetTime(iSMotionExactTime);

                    iSwMotionStudy->Play();

                    hr = iSwModel->Rebuild(swRebuildAll);

                    ASSERT(SUCCEEDED(hr));

                    CComPtr iSwLowerPartTFMatrix;

                    iSwLowerPart->get_Transform2(&iSwLowerPartTFMatrix);

                    set set_DistVertexGroup;

 

                    //Find 30 Groups of Min Distances and record the time, distance, points.

                              double scaleConst = 1000.0;

                              double coord1_Cond_beforeT[] = {33.037357/scaleConst,          -14.203015/scaleConst,          -40.330425/scaleConst};

                              double coord2_Cond_beforeT[] = {33.199257/scaleConst,          -19.714636/scaleConst,          -32.071205/scaleConst};

                              double coord3_Cond_beforeT[] = {34.426662/scaleConst,          -18.545341/scaleConst,          -46.908047/scaleConst};

                              CComPtr mathUtils;

                              iSwApp->IGetMathUtility(&mathUtils);

                              CComPtr iSwPointLowerPartPoint1_beforeT,iSwPointLowerPartPoint2_beforeT,iSwPointLowerPartPoint3_beforeT = NULL;

                              hr = mathUtils->ICreatePoint(coord1_Cond_beforeT,&iSwPointLowerPartPoint1_beforeT);

                              ASSERT(SUCCEEDED(hr));

                              hr = mathUtils->ICreatePoint(coord2_Cond_beforeT,&iSwPointLowerPartPoint2_beforeT);

                              ASSERT(SUCCEEDED(hr));

                              hr = mathUtils->ICreatePoint(coord3_Cond_beforeT,&iSwPointLowerPartPoint3_beforeT);

                              ASSERT(SUCCEEDED(hr));

                              //hr = iSwPointLowerPartPoint_beforeT->put_IArrayData(coord_Cond_beforeT);

                              CComPtr iSwPointLowerPartPoint1_afterT,iSwPointLowerPartPoint2_afterT,iSwPointLowerPartPoint3_afterT;

                              iSwPointLowerPartPoint1_beforeT->IMultiplyTransform(iSwLowerPartTFMatrix,&iSwPointLowerPartPoint1_afterT);

                              iSwPointLowerPartPoint2_beforeT->IMultiplyTransform(iSwLowerPartTFMatrix,&iSwPointLowerPartPoint2_afterT);

                              iSwPointLowerPartPoint3_beforeT->IMultiplyTransform(iSwLowerPartTFMatrix,&iSwPointLowerPartPoint3_afterT);

                              double coord1_Cond[] = {0.0, 0.0, 0.0};

                              double coord2_Cond[] = {0.0, 0.0, 0.0};

                              double coord3_Cond[] = {0.0, 0.0, 0.0};

                              iSwPointLowerPartPoint1_afterT->get_IArrayData(coord1_Cond);

                              iSwPointLowerPartPoint2_afterT->get_IArrayData(coord2_Cond);

                              iSwPointLowerPartPoint3_afterT->get_IArrayData(coord3_Cond);

                              OutCsv_LowerPartPts<

                                        scaleConst*(coord1_Cond[0])<<","<

                                        scaleConst*(coord2_Cond[0])<<","<

                                        scaleConst*(coord3_Cond[0])<<","<

                                        <<"\n";

 

                    nSteps++;

                    iSwMotionStudy->Stop();

                    iSMotionExactTime = iSMotionExactTime + ((double)TimeInterval)*0.001;

          }

          OutCsv_LowerPartPts.close();

Program result:

steptimep1-xp1-yp1-z
p2-xp2-yp2-z
p3-xp3-yp3-z
1033.0374-14.203-40.3304
33.1993-19.7146-32.0712
34.4267-18.5453-46.908
20.00533.0377-14.2053-40.3283
33.1999-19.7169-32.0691
34.427-18.5475-46.906
30.0133.0381-14.2103-40.3234
33.2011-19.722-32.0643
34.4274-18.5524-46.9012
40.01533.039-14.2173-40.3155
33.2029-19.7293-32.0565
34.4281-18.5592-46.8935
50.0233.0414-14.2352-40.2948
33.2075-19.7478-32.0362
34.4305-18.5763-46.8733
60.02533.0442-14.2423-40.2839
33.2111-19.7552-32.0256
34.433-18.583-46.8627
70.0333.0476-14.2463-40.2742
33.2151-19.7595-32.0162
34.4361-18.5867-46.8533
80.03533.0511-14.246-40.2676
33.2187-19.7595-32.0097
34.4393-18.5863-46.8468
90.0433.0545-14.2366-40.2679
33.2209-19.7503-32.0102
34.4424-18.5768-46.8472
100.04533.0534-14.2295-40.2759
33.2185-19.7433-32.0182
34.4416-18.5699-46.8551
110.0533.05-14.2237-40.2878
33.2137-19.7374-32.03
34.4388-18.5642-46.8668
120.05533.0454-14.2178-40.3038
33.2074-19.7312-32.0458
34.4349-18.5586-46.8824
130.0633.0392-14.2042-40.3363
33.199-19.716-32.0772
34.4298-18.5465-46.9137
140.06533.0398-14.1945-40.351
33.199-19.7047-32.0908
34.4304-18.5381-46.9275
150.0733.0425-14.1841-40.3625
33.2016-19.6925-32.101
34.4329-18.5292-46.938
160.07533.0466-14.1729-40.3718
33.2057-19.6794-32.1092
34.4366-18.5195-46.9465
170.0833.0565-14.1533-40.3805
33.2158-19.6574-32.1162
34.4452-18.5022-46.9539
180.08533.0608-14.1463-40.3814
33.2201-19.6497-32.1167
34.4489-18.4956-46.9547
190.0933.065-14.1421-40.379
33.2245-19.6455-32.1143
34.4525-18.4916-46.9523
200.09533.0688-14.1403-40.3752
33.2288-19.6438-32.1105
34.4558-18.4897-46.9486
210.133.0772-14.1416-40.3625
33.2382-19.6458-32.0983
34.463-18.4906-46.9365
220.10533.0809-14.1446-40.3547
33.2425-19.6494-32.0909
34.4662-18.4931-46.9291
230.1133.0838-14.1489-40.3457
33.2459-19.6546-32.0825
34.4687-18.4967-46.9207
240.11533.0841-14.1551-40.3376
33.2463-19.6621-32.0753
34.4689-18.5019-46.9132
250.1233.0758-14.1702-40.3266
33.2368-19.6806-32.0666
34.4614-18.5142-46.9039
260.12533.0678-14.1768-40.3255
33.2275-19.6889-32.0666
34.4542-18.5195-46.9035
270.1333.0589-14.1798-40.3288
33.217-19.6931-32.0707
34.4464-18.5216-46.9072
280.13533.0508-14.1793-40.3355
33.2073-19.6932-32.0777
34.4393-18.5207-46.914
290.1433.0448-14.1697-40.3469
33.1994-19.6832-32.0888
34.434-18.5115-46.9248
300.14533.0482-14.1636-40.3464
33.2031-19.6765-32.0879
34.437-18.5059-46.9241
310.1533.0548-14.1567-40.3428
33.2104-19.6689-32.0839
34.4426-18.4998-46.9203
320.15533.0626-14.15-40.3386
33.2191-19.6613-32.079
34.4493-18.4938-46.9158
330.1633.0759-14.1372-40.3361
33.2341-19.6464-32.0752
34.4609-18.4827-46.9125
340.16533.0797-14.1324-40.3388
33.2383-19.6406-32.0772
34.4643-18.4788-46.9148
350.1733.0828-14.1281-40.3418
33.2418-19.6353-32.0796
34.4672-18.4752-46.9173
360.17533.0862-14.1251-40.3426
33.2455-19.6315-32.0799
34.4703-18.4728-46.9178
370.1833.0962-14.1233-40.3326
33.2569-19.629-32.0694
34.4792-18.4715-46.9076
380.18533.1026-14.1256-40.322
33.2644-19.6314-32.0588
34.4849-18.4738-46.8972
390.1933.1095-14.1291-40.3097
33.2725-19.6351-32.0468
34.491-18.4772-46.8852
400.19533.1153-14.1342-40.2976
33.2796-19.6403-32.0348
34.4961-18.482-46.8734
410.233.1177-14.1462-40.285
33.2831-19.6528-32.0225
34.4984-18.4935-46.8611
420.20533.1132-14.1519-40.2862
33.2784-19.6587-32.0239
34.4947-18.499-46.8624
430.2133.1053-14.1557-40.2936
33.2696-19.6627-32.0313
34.4879-18.5026-46.8696
440.21533.0957-14.1578-40.3041
33.2589-19.6647-32.0417
34.4795-18.5047-46.8799
450.2233.0768-14.158-40.3273
33.2383-19.6638-32.0642
34.4627-18.5057-46.9022
460.22533.0693-14.1586-40.3365
33.2305-19.6635-32.0729
34.4558-18.5068-46.9109
470.2333.0619-14.1603-40.3456
33.2229-19.6646-32.0815
34.4493-18.5089-46.9195
480.23533.0544-14.1644-40.3548
33.215-19.6684-32.0905
34.4427-18.5132-46.9284
490.2433.0381-14.1758-40.3788
33.1968-19.6801-32.1146
34.4288-18.5242-46.9521
500.24533.03-14.1804-40.3938
33.1874-19.6851-32.1298
34.4221-18.5285-46.9671
510.2533.0243-14.1812-40.4082
33.1803-19.6859-32.1443
34.4174-18.5291-46.9813
520.25533.0216-14.1785-40.4192
33.1766-19.6831-32.1552
34.4152-18.5265-46.9921
530.2633.0223-14.1675-40.4286
33.1765-19.6713-32.1639
34.4158-18.5164-47.0009
540.26533.0215-14.1662-40.4272
33.1759-19.6697-32.1624
34.415-18.5153-46.9994
550.2733.0199-14.17-40.4204
33.1747-19.6737-32.1558
34.4134-18.5188-46.9928
560.27533.0171-14.1799-40.4086
33.1729-19.6844-32.1445
34.4107-18.5281-46.9814
570.2833.0114-14.208-40.3781
33.1695-19.7149-32.1157
34.4053-18.5538-46.9525
580.28533.0106-14.2199-40.3629
33.1697-19.7282-32.1015
34.4044-18.5645-46.9381
590.2933.0128-14.2258-40.3495
33.1726-19.7353-32.0888
34.4062-18.5695-46.9254
600.29533.0174-14.226-40.3392
33.1776-19.7363-32.079
34.4101-18.5691-46.9156
610.333.0294-14.2129-40.3313
33.1894-19.724-32.0717
34.4207-18.5556-46.9083
620.30533.0347-14.2041-40.3331
33.1942-19.7153-32.0735
34.4253-18.5469-46.9101
630.3133.0384-14.1953-40.3386
33.1972-19.7063-32.0789
34.4286-18.5383-46.9156
640.31533.0398-14.1878-40.3476
33.1979-19.6985-32.0877
34.43-18.5312-46.9244
650.3233.0371-14.1785-40.3717
33.1939-19.6879-32.1108
34.4279-18.5231-46.9475
660.32533.0342-14.1785-40.3816
33.1906-19.6871-32.1202
34.4255-18.5236-46.9569
670.3333.0315-14.1814-40.3868
33.1878-19.6897-32.1252
34.4233-18.5268-46.9619
680.33533.0298-14.1866-40.386
33.1864-19.6949-32.1245
34.422-18.5318-46.9611
690.3433.0295-14.1976-40.3715
33.187-19.7072-32.1108
34.4217-18.5417-46.9474
700.34533.0301-14.201-40.3634
33.188-19.7113-32.1032
34.4221-18.5445-46.9397
710.3533.0312-14.2017-40.358
33.1895-19.7124-32.0981
34.4228-18.5448-46.9346
720.35533.0326-14.1999-40.3559
33.1913-19.7106-32.096
34.4238-18.543-46.9326
730.3633.0349-14.1952-40.357
33.1948-19.7048-32.0964
34.4254-18.5391-46.9333
740.36533.0356-14.1958-40.3559
33.1964-19.7049-32.095
34.4259-18.5402-46.932
750.3733.0363-14.1996-40.3514
33.1981-19.7084-32.0903
34.4262-18.5442-46.9274
760.37533.0368-14.2064-40.343
33.1999-19.7152-32.0819
34.4264-18.5508-46.9192
770.3833.036-14.2254-40.3185
33.2012-19.7355-32.0584
34.4253-18.5684-46.8956
780.38533.0345-14.2354-40.3056
33.2002-19.7468-32.0464
34.4237-18.5773-46.8835
790.3933.0326-14.2428-40.2959
33.1985-19.7553-32.0373
34.4219-18.5838-46.8743
800.39533.031-14.2465-40.2902
33.1969-19.7597-32.0322
34.4204-18.5869-46.8691
810.433.032-14.2408-40.2887
33.1975-19.754-32.0306
34.4211-18.5815-46.8675
820.40533.0346-14.2355-40.288
33.2003-19.7482-32.0295
34.4234-18.5766-46.8665

Realtime data:

33.03736-14.203-40.3304
33.19926-19.7146-32.0712
34.42666-18.5453-46.908
33.03777-14.2063-40.3273
33.20015-19.718-32.0682
34.42704-18.5485-46.905
33.03849-14.2136-40.3199
33.2019-19.7254-32.0608
34.42771-18.5556-46.8977
33.03979-14.2237-40.308
33.20448-19.7359-32.0492
34.42889-18.5653-46.8862
33.04144-14.2352-40.2948
33.20747-19.7478-32.0362
34.43046-18.5763-46.8733
33.04503-14.2436-40.2813
33.21211-19.7566-32.0231
34.43377-18.5842-46.8602
33.04935-14.2468-40.2704
33.21696-19.7601-32.0124
34.43772-18.5871-46.8495
33.05325-14.2433-40.2654
33.22057-19.7569-32.0076
34.44125-18.5835-46.8447
33.05447-14.2366-40.2679
33.22085-19.7503-32.0102
34.44242-18.5768-46.8472
33.05276-14.2279-40.2786
33.2175-19.7416-32.0208
34.44106-18.5683-46.8577
33.04773-14.2209-40.2953
33.21059-19.7346-32.0374
34.43685-18.5616-46.8741
33.04216-14.2127-40.317
33.20308-19.7257-32.0587
34.43221-18.554-46.8952
33.03925-14.2042-40.3364
33.19901-19.716-32.0772
34.42984-18.5465-46.9137
33.04028-14.1918-40.3543
33.1994-19.7016-32.0938
34.4309-18.5358-46.9306
33.04447-14.1787-40.3672
33.20355-19.6862-32.1052
34.43464-18.5245-46.9423
33.05025-14.1643-40.3773
33.20932-19.6696-32.1139
34.43976-18.512-46.9514
33.05648-14.1533-40.3805
33.21578-19.6573-32.1162
34.44516-18.5022-46.9539
33.06183-14.1449-40.3812
33.22121-19.6483-32.1165
34.4498-18.4943-46.9544
33.06698-14.141-40.377
33.22672-19.6445-32.1123
34.45423-18.4905-46.9504
33.07173-14.1399-40.3717
33.23195-19.6436-32.1072
34.45834-18.4892-46.9453
33.07719-14.1416-40.3625
33.23824-19.6458-32.0983
34.46304-18.4906-46.9365
33.0817-14.1455-40.3526
33.24348-19.6505-32.0889
34.46691-18.4939-46.9271
33.08442-14.1518-40.3413
33.24666-19.6581-32.0785
34.46919-18.4991-46.9166
33.08218-14.1608-40.3328
33.24414-19.669-32.0713
34.46711-18.5066-46.9091
33.0758-14.1702-40.3266
33.23681-19.6806-32.0666
34.46137-18.5142-46.9039
33.06552-14.178-40.326
33.22488-19.6905-32.0673
34.45225-18.5205-46.904
33.05464-14.1799-40.3319
33.21192-19.6936-32.0739
34.44266-18.5214-46.9103
33.04643-14.1769-40.3412
33.2019-19.6909-32.0834
34.43547-18.5183-46.9195
33.04482-14.1697-40.3469
33.19944-19.6832-32.0888
34.43403-18.5115-46.9248
33.04966-14.1619-40.3457
33.20465-19.6747-32.0871
34.43817-18.5045-46.9234
33.05867-14.1532-40.3406
33.21472-19.6649-32.0814
34.44594-18.4966-46.918
33.0682-14.1453-40.3363
33.22551-19.6558-32.0762
34.45419-18.4897-46.9132
33.07589-14.1372-40.3361
33.23409-19.6464-32.0752
34.46094-18.4827-46.9125
33.08048-14.1314-40.3397
33.23923-19.6393-32.0779
34.46507-18.4779-46.9155
33.08448-14.1263-40.3426
33.24358-19.6331-32.0801
34.46872-18.4738-46.9179
33.08925-14.124-40.3408
33.24899-19.63-32.0778
34.47304-18.472-46.9158
33.09623-14.1233-40.3325
33.25689-19.629-32.0694
34.47924-18.4715-46.9076
33.10436-14.1265-40.3189
33.26647-19.6323-32.0558
34.48642-18.4746-46.8942
33.11269-14.1314-40.3035
33.27638-19.6375-32.0406
34.49379-18.4793-46.8792
33.11794-14.1389-40.2903
33.28304-19.6451-32.0276
34.4985-18.4866-46.8662
33.11765-14.1462-40.285
33.28312-19.6528-32.0224
34.49842-18.4936-46.8611
33.11151-14.1531-40.2875
33.27654-19.66-32.0252
34.49322-18.5001-46.8636
33.10054-14.1569-40.2988
33.26422-19.6639-32.0365
34.48373-18.5038-46.8747
33.08829-14.1585-40.3127
33.25076-19.6651-32.0501
34.47293-18.5056-46.8881
33.07678-14.158-40.3274
33.23829-19.6638-32.0642
34.46264-18.5057-46.9022
33.06743-14.1589-40.3388
33.22864-19.6636-32.075
34.45418-18.5072-46.913
33.05817-14.162-40.3503
33.21895-19.666-32.0861
34.44595-18.5107-46.924
33.04857-14.1689-40.3624
33.20866-19.6729-32.0981
34.43765-18.5175-46.9359
33.03806-14.1758-40.3789
33.1968-19.6801-32.1147
34.42879-18.5242-46.9522
33.02826-14.1811-40.3976
33.18531-19.6858-32.1337
34.42065-18.5291-46.9708
33.02252-14.1801-40.4144
33.17801-19.6848-32.1504
34.41596-18.5281-46.9874
33.02131-14.1748-40.4245
33.1759-19.6792-32.1604
34.41503-18.5231-46.9973
33.02229-14.1675-40.4286
33.17654-19.6712-32.1639
34.41583-18.5164-47.0009
33.02115-14.1667-40.426
33.17558-19.6702-32.1612
34.41465-18.5158-46.9982
33.01867-14.1741-40.415
33.17393-19.6782-32.1506
34.41222-18.5227-46.9876
33.01452-14.1905-40.3974
33.17114-19.6959-32.1339
34.40828-18.5379-46.9708
33.01144-14.208-40.378
33.16946-19.715-32.1156
34.40531-18.5538-46.9524
33.01086-14.2221-40.3593
33.17011-19.7307-32.098
34.40459-18.5664-46.9347
33.01495-14.2265-40.3438
33.17499-19.7364-32.0834
34.40803-18.5698-46.92
33.0216-14.223-40.3341
33.18191-19.7337-32.0742
34.4138-18.5658-46.9108
33.02945-14.2129-40.3313
33.1894-19.7239-32.0717
34.42068-18.5556-46.9083
33.03577-14.2019-40.3341
33.19511-19.713-32.0745
34.42628-18.5447-46.9111
33.03943-14.1912-40.3428
33.19785-19.7021-32.083
34.42955-18.5344-46.9196
33.03946-14.1835-40.3563
33.19698-19.6938-32.0961
34.42973-18.5273-46.9327
33.03712-14.1785-40.3717
33.19386-19.6878-32.1109
34.42787-18.5231-46.9475
33.03339-14.179-40.3834
33.1898-19.6875-32.122
34.42484-18.5243-46.9587
33.03049-14.1838-40.3872
33.18691-19.692-32.1256
34.42251-18.5291-46.9623
33.02932-14.1912-40.3818
33.1862-19.6998-32.1205
34.42158-18.5361-46.9571
33.02953-14.1977-40.3715
33.18698-19.7072-32.1108
34.42169-18.5418-46.9473
33.03035-14.2015-40.3617
33.18837-19.7119-32.1016
34.4222-18.5448-46.9381
33.03186-14.201-40.3566
33.19037-19.7118-32.0967
34.42327-18.5441-46.9332
33.03365-14.1977-40.3559
33.19275-19.7081-32.0959
34.42458-18.5411-46.9325
33.03491-14.1951-40.357
33.19479-19.7048-32.0964
34.42545-18.5391-46.9333
33.03581-14.1965-40.3551
33.19681-19.7055-32.0941
34.42599-18.5409-46.9312
33.03658-14.2027-40.3476
33.19905-19.7114-32.0865
34.42637-18.5472-46.9237
33.03686-14.213-40.3345
33.20082-19.7221-32.0736
34.42631-18.557-46.911
33.03603-14.2254-40.3184
33.20116-19.7356-32.0583
34.42527-18.5684-46.8956
33.03404-14.2376-40.3027
33.19984-19.7494-32.0437
34.42325-18.5793-46.8808
33.0317-14.2451-40.2925
33.19763-19.7581-32.0342
34.42102-18.5858-46.8712
33.03062-14.2464-40.2885
33.19636-19.7598-32.0306
34.42-18.5867-46.8674
33.03198-14.2408-40.2887
33.1975-19.7539-32.0306
34.42114-18.5815-46.8675
33.03545-14.2341-40.2875
33.20118-19.7467-32.029
34.42407-18.5753-46.866
33.03959-14.2283-40.2842
33.20579-19.7403-32.0253
34.42753-18.5699-46.8625
33.04218-14.2264-40.2811
33.20904-19.738-32.0219
34.42967-18.5684-46.8593
33.04165-14.2257-40.2844
33.20867-19.7367-32.0249
34.42918-18.5681-46.8623
33.03904-14.2255-40.2947
33.20594-19.7355-32.0345
34.42704-18.5686-46.872
33.03648-14.2229-40.3101
33.20295-19.7315-32.0489
34.4251-18.5672-46.8866
SolidworksApi macros