Jump to content

Create Sphere between 2 positions


Recommended Posts

Hey!

I can't figure out how to create a sphere between 2 positions (X/Y).

Currently I use createColCuboid and calculate the width and depth like this:

width = math.abs(x1-x2) 
depth = math.abs(y1-y2) 

But when I create a sphere with a command, the sphere sometime gets created to the wrong/opposite side.

For example:

I create a sphere from the station at SF to the police department, but it gets created from the station to the opposite side.

Is there another function to create a sphere with two positions?

Link to comment

I don't understand your question to be honest. If you get wrong coords that's because you use math.abs which will always give you positive values. But still, your question is not clear. "Create sphere between 2 points" doesn't say much.

Link to comment

Correct me if I am wrong:

you want to create a sphere using Dx, giving 2 coords > (x,y,z) and (x1,y1,z1) .

and using this 2 coords you get the middle of the line segment, right ? that will be this point : ( (x1-x)/2 , (y1-y)/2 , (z1-z)/2 )

and using this point, you will create the sphere, with that center : ( (x1-x)/2 , (y1-y)/2 , (z1-z)/2 ) and with a given radius, depending on the distance between those points, using square root.

Is that you want ?

Link to comment
Just tried it^^

The problem is that (x1-x)/2 , (y1-y)/2 , (z1-z)/2 is not the center of those points :/

But the width and height is ok now :)

Sorry my bad, is not subtract is sum.

Like this : (x1+x)/2 , (y1+y)/2 , (z1+z)/2

Try it , and say the results, if its ok

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...