1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved How can I get the edges of cube?

Discussion in 'Development' started by Pylay, Aug 7, 2018.

  1. Pylay

    Pylay Spider

    Messages:
    10
    I made a cube of 2 extreme points and I have a question how to get these edges of this cube?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Differentiate with each coordinate of the other extreme, one at a time.
    Code:
    # A and B are two extremes
    # x1 <= x2, y1 <= y2, z1 <= z2
    
    A = Vector3(x1, y1, z1)
    B = Vector3(x2, y2, z2)
    
    # Edges:
    From A to A->add(x2, 0, 0),
    From A to A->add(0, y2, 0),
    From A to A->add(0, 0, z2),
    From B->subtract(x1, 0, 0) to B,
    From B->subtract(0, y1, 0) to B,
    From B->subtract(0, 0, z1) to B
    
     
    Pylay likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.