About XYZ class operation, by using two XYZs

About XYZ class operation, by using two XYZs

dcj219
Participant Participant
588 Views
1 Reply
Message 1 of 2

About XYZ class operation, by using two XYZs

dcj219
Participant
Participant

XYZ p1,  XYZ p2,  double length, how can I operate these paras to get XYZ p3?  Location of p3 is on the line between p1 and p2,  distance between p1 and p3 is the length. I can't find something useful for this in api document. _(:з)∠)_  thx

0 Likes
Accepted solutions (1)
589 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

There are hundreds of examples showing similar calculation on The Building Coder blog: 

 

https://thebuildingcoder.typepad.com/

 

For example, to get p3 in the middle between p1 and p2, you can use something like this, from The Building Coder samples Util class:

 

https://github.com/jeremytammik/the_building_coder_samples

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/U...

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/U...

 

    /// <summary>
    /// Return the midpoint between two points.
    /// </summary>
    public static XYZ Midpoint( XYZ p, XYZ q )
    {
      return 0.5 * (p + q);
    }

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes