{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"distance-3d"},"result":{"entity_type":"calculator","id":"distance-3d","calculator_id":"distance-3d","canonical_url":"https://tttkmbb.com/math/distance-3d","name":"3D Distance Calculator","title":"3D Distance Calculator – Distance, Midpoint and Direction Cosines Between Two Points in Space","category":"math","category_name":"Math","tool_name":"calculate_distance_3d","featured_mcp_tool":false,"description":"Computes the Euclidean distance between two points in three-dimensional space, their midpoint, the coordinate differences, the direction cosines and direction angles of the connecting segment, and the Manhattan distance.","use_when":"You have two (x, y, z) coordinates and need the straight-line distance, the halfway point or the direction of the line between them.","do_not_use_when":"The points are in a plane (use distance-2d), you need vector products or the angle between two vectors (use vector-operations), or the points are geographic coordinates (use haversine-distance).","inputs":[{"name":"x1","label":"x₁","type":"number","required":true,"description":"x-coordinate of the first point.","example":1},{"name":"y1","label":"y₁","type":"number","required":true,"description":"y-coordinate of the first point.","example":2},{"name":"z1","label":"z₁","type":"number","required":true,"description":"z-coordinate of the first point.","example":3},{"name":"x2","label":"x₂","type":"number","required":true,"description":"x-coordinate of the second point.","example":4},{"name":"y2","label":"y₂","type":"number","required":true,"description":"y-coordinate of the second point.","example":6},{"name":"z2","label":"z₂","type":"number","required":true,"description":"z-coordinate of the second point.","example":15}],"outputs":[{"name":"distance","label":"Distance","type":"number","decimals":6,"description":"√((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)."},{"name":"midpoint_x","label":"Midpoint x","type":"number","decimals":6,"description":"(x₁ + x₂) / 2."},{"name":"midpoint_y","label":"Midpoint y","type":"number","decimals":6,"description":"(y₁ + y₂) / 2."},{"name":"midpoint_z","label":"Midpoint z","type":"number","decimals":6,"description":"(z₁ + z₂) / 2."},{"name":"midpoint","label":"Midpoint","type":"string","decimals":4,"description":"The midpoint as a coordinate triple, e.g. '(2.5, 4, 9)'."},{"name":"delta_x","label":"Δx","type":"number","decimals":6,"description":"x₂ − x₁."},{"name":"delta_y","label":"Δy","type":"number","decimals":6,"description":"y₂ − y₁."},{"name":"delta_z","label":"Δz","type":"number","decimals":6,"description":"z₂ − z₁."},{"name":"direction_cosines","label":"Direction cosines","type":"number_list","decimals":6,"description":"[Δx, Δy, Δz] / distance = [cos α, cos β, cos γ]; their squares sum to 1."},{"name":"direction_angles_degrees","label":"Direction angles","type":"number_list","unit":"°","decimals":4,"description":"[α, β, γ]: angles between the segment (from point 1 to point 2) and the positive x, y and z axes."},{"name":"manhattan_distance","label":"Manhattan distance","type":"number","decimals":6,"description":"|Δx| + |Δy| + |Δz|."}],"input_schema":{"type":"object","properties":{"x1":{"description":"x-coordinate of the first point.","type":"number","examples":[1]},"y1":{"description":"y-coordinate of the first point.","type":"number","examples":[2]},"z1":{"description":"z-coordinate of the first point.","type":"number","examples":[3]},"x2":{"description":"x-coordinate of the second point.","type":"number","examples":[4]},"y2":{"description":"y-coordinate of the second point.","type":"number","examples":[6]},"z2":{"description":"z-coordinate of the second point.","type":"number","examples":[15]}},"additionalProperties":false,"required":["x1","y1","z1","x2","y2","z2"]},"output_schema":{"type":"object","properties":{"distance":{"description":"√((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²).","type":"number"},"midpoint_x":{"description":"(x₁ + x₂) / 2.","type":"number"},"midpoint_y":{"description":"(y₁ + y₂) / 2.","type":"number"},"midpoint_z":{"description":"(z₁ + z₂) / 2.","type":"number"},"midpoint":{"description":"The midpoint as a coordinate triple, e.g. '(2.5, 4, 9)'.","type":"string"},"delta_x":{"description":"x₂ − x₁.","type":"number"},"delta_y":{"description":"y₂ − y₁.","type":"number"},"delta_z":{"description":"z₂ − z₁.","type":"number"},"direction_cosines":{"description":"[Δx, Δy, Δz] / distance = [cos α, cos β, cos γ]; their squares sum to 1.","type":"array","items":{"type":"number"}},"direction_angles_degrees":{"description":"[α, β, γ]: angles between the segment (from point 1 to point 2) and the positive x, y and z axes. Unit: °.","type":"array","items":{"type":"number"},"x-unit":"°"},"manhattan_distance":{"description":"|Δx| + |Δy| + |Δz|.","type":"number"}}},"formula":"distance = √(Δx² + Δy² + Δz²); midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2, (z₁ + z₂)/2); cos α = Δx / distance, cos β = Δy / distance, cos γ = Δz / distance; manhattan = |Δx| + |Δy| + |Δz|","sources":[{"name":"Wikipedia – Euclidean distance","url":"https://en.wikipedia.org/wiki/Euclidean_distance","type":"reference","retrieved_at":"2026-09-24"},{"name":"Wikipedia – Direction cosine","url":"https://en.wikipedia.org/wiki/Direction_cosine","type":"reference","retrieved_at":"2026-09-24"},{"name":"Wolfram MathWorld – Direction Cosine","url":"https://mathworld.wolfram.com/DirectionCosine.html","type":"reference","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"(1, 2, 3) to (4, 6, 15)","inputs":{"x1":1,"y1":2,"z1":3,"x2":4,"y2":6,"z2":15},"expected":{"distance":13,"midpoint_x":2.5,"midpoint_y":4,"midpoint_z":9,"midpoint":"(2.5, 4, 9)","delta_x":3,"delta_y":4,"delta_z":12,"direction_cosines":[0.230769,0.307692,0.923077],"direction_angles_degrees":[76.6576,72.0798,22.6199],"manhattan_distance":19},"url":"https://tttkmbb.com/api/v1/calculate/distance-3d?x1=1&y1=2&z1=3&x2=4&y2=6&z2=15"},{"name":"Origin to (2, 3, 6)","inputs":{"x1":0,"y1":0,"z1":0,"x2":2,"y2":3,"z2":6},"expected":{"distance":7,"midpoint":"(1, 1.5, 3)","direction_cosines":[0.285714,0.428571,0.857143],"manhattan_distance":11},"url":"https://tttkmbb.com/api/v1/calculate/distance-3d?x1=0&y1=0&z1=0&x2=2&y2=3&z2=6"}],"faq":[{"q":"What are direction cosines used for?","a":"They are the components of the unit vector from point 1 to point 2, so they describe the orientation of the segment; cos²α + cos²β + cos²γ = 1 always holds."},{"q":"Does the order of the points matter?","a":"Not for distance or midpoint. Δx, Δy, Δz, the direction cosines and angles are taken from point 1 to point 2 and flip sign (angles become 180° − angle) if the points are swapped."}],"tags":["3d distance","distance between two points 3d","midpoint 3d","direction cosines","direction angles","xyz distance"],"related":[{"calculator_id":"distance-2d","reason":"The planar version with Manhattan distance and midpoint."},{"calculator_id":"vector-operations","reason":"Treat the two points as vectors: dot and cross products, angle."},{"calculator_id":"pythagorean","reason":"The distance formula is the Pythagorean theorem applied twice."}],"links":{"html":"https://tttkmbb.com/math/distance-3d","markdown":"https://tttkmbb.com/math/distance-3d.md","json":"https://tttkmbb.com/math/distance-3d.json","api":"https://tttkmbb.com/api/v1/calculate/distance-3d","schema":"https://tttkmbb.com/api/v1/calculators/distance-3d","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T01:57:52Z"}