Can someone help us.
I have a problem with one algorithm. I can't solve it.
It is about sorting the numbers from largest to smallest.
Subject - Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Each object has several objects.
Each object has several sides
Each side has several coordinates.
What can change.
I have to sort them out.
Vk = random number
Object(1, 1, 1, 0).z = Vk
Object(1, 1, 1, 1).x = -Vk
Object(1, 1, 1, 1).y = -Vk
Object(1, 1, 4, 4).x = Vk
Object(1, 1, 4, 4).y = -Vk
Object(1, 1, 4, 4).z = Vk
Object(2, 1, 2, 6).x = Vk
Object(2, 1, 2, 6).y = Vk
Object(2, 1, 2, 6).z = Vk
Object ( 2 , 1 , 2 , 6 )
Subject - Object - Page - coordinates
I calculated the coordinates and counted the walls on the perimeter.
Now I have a Subject and an Object
I tried this and it doesn't work very well:
SwapPage(i, a, b).z = SwapPage(i, a, b).z + Z
SwapObjects(i, a).z = SwapObjects(i, a).z + SwapPages(i, a, b).z
--
SwapSubjects(i).z = SwapSubjects(i).z + SwapObjects(i, a).z
this is no longer possible
because the sum of different items is too big and it doesn't work
--
SwappingPage:
For i = 1 To Number of Subjects
If EnableSwapObject(s) = 1 Then
= 0 again
For a = 1 To Subject(s).Number of Objects
For b = 1 To Subject(s). Number of Pages
k = 1: If b = Subject(s).NumberPages Then k = 0
If SwapPage(i, a, b).z > SwapPage(i, a, b + k).z Then
Swap SwapPage(i, a, b).z, SwapPage(i, a, b + k).z
Again = 1
End If
Further b
Further a
If Again = 1, then go to SwappingPage:
End If
Further i
SwappingObjects:
For i = 1 To Number of Subjects
If EnableSwapObject(s) = 1 Then
Again = 0: O = 0: If i = Number of Subjects Then O = 1
For a = 1 To Subject(s).Number of Objects
k = 1: If a = Subject(s).Number of Objects Then k = 0
If SwapObjects(i - O, a).z < SwapObjects(i, a + k).z Then
Swap SwapObjects(i - O, a).z, SwapObjects(i, a + k).z
Again = 1
End If
Further a
End If
Further i
If Again = 1 Then GoTo SwappingObjects
-------------------------------------------------- -------------------------------------
Here's the problem:
Exchange of Subjects:
Again = 0: ii = 0: a1 = 1: a = 0
For i = 1 To Number of Subjects
ii = ii + 1
If i + ii >= Number of Subjects Then ii = 0: Again = 0
If EnableSwapObjects(i) = 1 or EnableSwapObjects(i + ii) = 1 Then
To
a = a + 1
If SwapObjects(i, a).z < SwapObjects(i + ii, a1).z Then
Swap SwapObjects(i, a).z, SwapObjects(i + ii, a1).z
Again = 1
End If
If a >= Object(s).CountObjects Then
a = 0
a1 = a1 + 1
End If
If a1 >= Subject(i + ii).Number of Objects Then a1 = 1: Exit Do
Loop until again = 1
End If
Further i
If Again = 1 Then GoTo SwappingSubjects
I have a problem with one algorithm. I can't solve it.
It is about sorting the numbers from largest to smallest.
Subject - Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Side - coordinates
- coordinates
- coordinates
Subject - Object - Page - coordinates
- coordinates
- coordinates
- coordinates
- coordinates
- coordinates
Each object has several objects.
Each object has several sides
Each side has several coordinates.
What can change.
I have to sort them out.
Vk = random number
Object(1, 1, 1, 0).z = Vk
Object(1, 1, 1, 1).x = -Vk
Object(1, 1, 1, 1).y = -Vk
Object(1, 1, 4, 4).x = Vk
Object(1, 1, 4, 4).y = -Vk
Object(1, 1, 4, 4).z = Vk
Object(2, 1, 2, 6).x = Vk
Object(2, 1, 2, 6).y = Vk
Object(2, 1, 2, 6).z = Vk
Object ( 2 , 1 , 2 , 6 )
Subject - Object - Page - coordinates
I calculated the coordinates and counted the walls on the perimeter.
Now I have a Subject and an Object
I tried this and it doesn't work very well:
SwapPage(i, a, b).z = SwapPage(i, a, b).z + Z
SwapObjects(i, a).z = SwapObjects(i, a).z + SwapPages(i, a, b).z
--
SwapSubjects(i).z = SwapSubjects(i).z + SwapObjects(i, a).z
this is no longer possible
because the sum of different items is too big and it doesn't work
--
SwappingPage:
For i = 1 To Number of Subjects
If EnableSwapObject(s) = 1 Then
= 0 again
For a = 1 To Subject(s).Number of Objects
For b = 1 To Subject(s). Number of Pages
k = 1: If b = Subject(s).NumberPages Then k = 0
If SwapPage(i, a, b).z > SwapPage(i, a, b + k).z Then
Swap SwapPage(i, a, b).z, SwapPage(i, a, b + k).z
Again = 1
End If
Further b
Further a
If Again = 1, then go to SwappingPage:
End If
Further i
SwappingObjects:
For i = 1 To Number of Subjects
If EnableSwapObject(s) = 1 Then
Again = 0: O = 0: If i = Number of Subjects Then O = 1
For a = 1 To Subject(s).Number of Objects
k = 1: If a = Subject(s).Number of Objects Then k = 0
If SwapObjects(i - O, a).z < SwapObjects(i, a + k).z Then
Swap SwapObjects(i - O, a).z, SwapObjects(i, a + k).z
Again = 1
End If
Further a
End If
Further i
If Again = 1 Then GoTo SwappingObjects
-------------------------------------------------- -------------------------------------
Here's the problem:
Exchange of Subjects:
Again = 0: ii = 0: a1 = 1: a = 0
For i = 1 To Number of Subjects
ii = ii + 1
If i + ii >= Number of Subjects Then ii = 0: Again = 0
If EnableSwapObjects(i) = 1 or EnableSwapObjects(i + ii) = 1 Then
To
a = a + 1
If SwapObjects(i, a).z < SwapObjects(i + ii, a1).z Then
Swap SwapObjects(i, a).z, SwapObjects(i + ii, a1).z
Again = 1
End If
If a >= Object(s).CountObjects Then
a = 0
a1 = a1 + 1
End If
If a1 >= Subject(i + ii).Number of Objects Then a1 = 1: Exit Do
Loop until again = 1
End If
Further i
If Again = 1 Then GoTo SwappingSubjects