Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 212639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:12:18+00:00 2026-05-11T18:12:18+00:00

I have a simple object that allows you to assign three properties (x,y,z) (lets

  • 0

I have a simple object that allows you to assign three properties (x,y,z) (lets call this object a “point”, because that is what it is). I then have a second object with a method that accepts two instances of the first object, and returns the distance between the two “points” in three dimensional space. I also need a method that will accept two “points”
and a double, representing distance traveled (from the first “point” parameter used) that returns a “point” object with its x,y,z coordinates.

I’m ok with everything except the calculation of the point coordinates that are on the original line between the two points supplied, that is at a certain distance from the first point.

“point” object:

public class POR
{
    private double PORX;
    private double PORY;
    private double PORZ;

    public double X
    {
        get { return PORX; }
        set { PORX = value; }
    }
    public double Y
    {
        get { return PORY; }
        set { PORY = value; }
    }
    public double Z
    {
        get { return PORZ; }
        set { PORZ = value; }
    }
    public POR(double X, double Y, double Z)
    {
        PORX = X;
        PORY = Y;
        PORZ = Z;
    }

I’m then using :

    public double PorDistance(POR por1, POR por2)
    {
        return Math.Round(Math.Sqrt( Math.Pow((por1.X - por2.X),2) + Math.Pow((por1.Y - por2.Y),2) + Math.Pow((por1.Z - por2.Z),2)),2);
    }

to return the distance between those two points I need something like

public POR IntersectPOR (POR por1, POR por2, double distance)
{

}

where distance is the distance traveled from por1 towards por2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:12:19+00:00Added an answer on May 11, 2026 at 6:12 pm

    This can be done with a bit of help from vectors.

    Let’s say your starting point is called P, and the other point is Q, and the distance is d. You want to find the point on the line PQ at a distance d from P towards Q.

    1. First you need to find the direction of travel. That’s done by finding Q – P

      v = Point(Q.x - P.x, Q.y - P.y, Q.z - P.z)
      
    2. Now you need to find the unit vector in that direction, so

      scale = sqrt(v.x*v.x + v.y*v.y + v.z*v.z)
      unit = Point(v.x/scale, v.y/scale, v.z/scale)
      
    3. Now you need to find the vector representing the distance traveled:

      t = Point(unit.x*d, unit.y*d, unit.z*d)
      
    4. To find the final position, add your traveled vector to your starting point:

      final = Point(P.x + t.x, P.y + t.y, P.z + t.z)
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple object that get's geocoding data from the Google Maps API
I have a code sample that gets a SEL from the current object, SEL
I'm relatively new to the Component Object Model specification - I have a simple
Pretty simple question: When i have a persistable object, it usually has a property
I have seen sample source code around that uses different ways of releasing/dealloc'ing objects,
I have an object graph serialized to xaml. A rough sample of what it
I have simple regex \.*\ for me its says select everything between and ,
Ok, i have simple scenario: have two pages: login and welcome pages. im using
In general, is it a best practice to have simple POJO Java classes implement
I develop tools in Autodesk Maya. Many of the tools I build have simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.