Advertisement
  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. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    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. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    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. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

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

    zombie_Power Active Member

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

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  6. zombie_Power
    Offline

    zombie_Power Active Member

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

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    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. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    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. Yosshi999
    Offline

    Yosshi999 New Member Plugin Developer

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

    Yosshi999 New Member Plugin Developer

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

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    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. Yosshi999
    Offline

    Yosshi999 New Member Plugin Developer

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

    Yosshi999 New Member Plugin Developer

    Joined:
    Mar 13, 2014
    Posts:
    29
    Plugins:
    1
    Minecraft User:
    Yosshi999
    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. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

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

    Yosshi999 New Member Plugin Developer

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

    PEMapModder Notable Member Plugin Developer

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

Share This Page

Advertisement