1. Список говнокодов пользователя IVK

    Всего: 1

  2. C++ / Говнокод #23072

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    for (int i = 0; i < WorkedVerts.count(); i++)
    	{
    		int R0 = (i + Offset0) % WorkedVerts.count();
    		int R1 = (i + Offset1) % WorkedVerts.count();
    		int R2 = (i + Offset2) % WorkedVerts.count();
    
    		XA << WorkedVerts.at(R0).Position;
    		XB << WorkedVerts.at(R1).Position;
    		XC << WorkedVerts.at(R2).Position;
    	}
    	PrepareDataPointers(XA, XB, XC);
    	Inset_Cuda(InputData0, InputData1, InputData2, OutputData, XA.count(), -Amount);
    
    	for (int x = 0; x < XA.count(); x++)
    	{
    		if (fabs(OutputData[x].x) < 0.0001f && fabs(OutputData[x].y) < 0.0001f && fabs(OutputData[x].z < 0.0001f))
    		{
    			int Start = x;
    			int Start1 = (x + (XA.count() - 1)) % XA.count();
    			QVector3D StartVec = QVector3D(OutputData[Start1].x, OutputData[Start1].y, OutputData[Start1].z);
    			QVector3D EndVec = StartVec;
    			int End = 0;
    			while (true)
    			{
    				End = Start++;
    				if (fabs(OutputData[End].x) > 0.0001f && fabs(OutputData[End].y) > 0.0001f && fabs(OutputData[End].z > 0.0001f))
    				{
    					EndVec = QVector3D(OutputData[End].x, OutputData[End].y, OutputData[End].z);
    					break;
    				}
    			}
    			QVector3D OffsetX0 = WorkedVerts.at(Start).Position - StartVec;
    			QVector3D OffsetX1 = WorkedVerts.at(End).Position - EndVec;
    			QVector3D Mid2 = OffsetX0 + (OffsetX1 - OffsetX0) * 0.5f;
    			OutputData[x].x = Mid2.x();
    			OutputData[x].y = Mid2.y();
    			OutputData[x].z = Mid2.z();
    		}
    	}
    	int VertsCounter = SharedVerts.count();
    	for (int i = 0; i < WorkedVerts.count(); i++)
    	{
    		SharedVertex NewVert;
    		int Count3 = WorkedVerts.count();
    		int index = (i + (Count3 - 1)) % Count3;
    		NewVert.Position = QVector3D(OutputData[index].x, OutputData[index].y, OutputData[index].z);
    		NewVert.Index = VertsCounter++;
    		SV2 << NewVert;
    	}

    Код нахождения копии контура вершин с оффсетом.

    IVK, 26 Мая 2017

    Комментарии (3)