1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

# Bounds of an oblique cylinder

Comments in 'Plugin Development' started by PEMapModder, Nov 22, 2015.

1. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
I am working on cylinders in WorldEditArt, and due to my stubborn and impatient nature, I am trying to let cylinders be oblique.

So, I am defining a cylinder with these parameters:

Code:
```T(x2, y2, z2)
|||
v

^
/ \
<   \
\   \
\   \
\   >
\ /   <= B(x1, y1, z1)
v   <= distance from B = r

```
This is a the side view of an example of the cylinder, where B is the base point, T is the top point and r is the radius of the cylinder.

Now say, if we are having a right cuboid (a cuboid that is perpendicular/parallel to the X, Y and Z axes) to just inscribe the cylinder, like this:

Code:
``` ________
|  ^     |
| / \    |
|<   \   |
| \   \  |
|  \   \ |
|   \   >|
|    \ / |
|     v  |
|--------|```
How can I find out the dimensions (minimum and maximum X, Y and Z coordinates) of the cuboid?

To set all blocks in the cylinder, I am trying to iterate through the integer points inside this cuboid, check distance of the point from the central vector BT (which I already found out how from Wolfram Mathworld), and if true, update the block.
Or is there another way to do this without iterating through blocks in the cuboid?
Legoboy0215, LDX and Andrey Nazarchuk like this.
2. Offline

### zombie_PowerActive Member

Joined:
Sep 7, 2015
Posts:
239
Minecraft User:
Just to make sure, that I (and others) fully understand your concept, are you also trying to achieve a circular shape from a top view?
As smaller cylinders maybe not be able to achieve that circular shape. Btw the shape you provide seems like your cylinders are more of tilted, than oblique.
3. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
By oblique cylinder, I meant tilted cylinder. It is still a cyliner, but it is placed at a different angle.
Legoboy0215 likes this.
4. Offline

### zombie_PowerActive Member

Joined:
Sep 7, 2015
Posts:
239
Minecraft User:
Can you please post code?
5. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
6. Offline

### zombie_PowerActive Member

Joined:
Sep 7, 2015
Posts:
239
Minecraft User:
7. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
oblique means tilted. I have wrote the code to check whether a point is in the cylinder, but I need code for vector-plane angle to calculate the boundaries.
8. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
Let me simply the question:
How to get a line's angle with a plane in a 3D system, where the line is defined by two points of coordinates?
9. Offline

### Yosshi999New MemberPlugin Developer

Joined:
Mar 13, 2014
Posts:
29
Plugins:
1
Minecraft User:
Is a 'plane' always the ground?
10. Offline

### Yosshi999New MemberPlugin Developer

Joined:
Mar 13, 2014
Posts:
29
Plugins:
1
Minecraft User:
i think 'oblique projection vector' is useful.
Last edited: Nov 24, 2015
PEMapModder likes this.
11. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
I see what you mean. Like this?

Code:
```         /
/
/
/
/
/
/
/
/ ) θ
≤_________
(Calculate this point by (X2, Y1, Z2)
(Then use cosine to calculate θ)```
Last edited: Nov 24, 2015
12. Offline

### Yosshi999New MemberPlugin Developer

Joined:
Mar 13, 2014
Posts:
29
Plugins:
1
Minecraft User:
yes
13. Offline

### Yosshi999New MemberPlugin Developer

Joined:
Mar 13, 2014
Posts:
29
Plugins:
1
Minecraft User:
When you project a tilted cylinder on the ground (y=0), the shadow will be one tilted rectangle + two ellipses.
The size of these ellipses is r * (r cosθ),
θ is the angle between (0,1,0) and (X2-X1,Y2-Y1,Z2-Z1).
sorry poor English
PEMapModder likes this.
14. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
Legoboy0215 likes this.
15. Offline

### Yosshi999New MemberPlugin Developer

Joined:
Mar 13, 2014
Posts:
29
Plugins:
1
Minecraft User:
Too long code for me to read!
Does it work correctly?
16. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
Not tested. I used r*cos(length/projection length) to calculate the distance between lower center and lowermost point, so it should be correct.