Skip to content

ORDERED_PAIR_2_VECTOR

Download Flojoy Studio to try this app
Returns the split components (x, y) of an ordered pair as Vectors. Params: default : OrderedPair The input OrderedPair. Returns: TypedDict : x: Vector from input x y: Vector from input y
Python Code
from flojoy import flojoy, Vector, OrderedPair
from typing import TypedDict


class ResultSplit(TypedDict):
    x: Vector
    y: Vector


@flojoy
def ORDERED_PAIR_2_VECTOR(default: OrderedPair) -> ResultSplit:
    """Returns the split components (x, y) of an ordered pair as Vectors.

    Parameters
    ----------
    default : OrderedPair
        The input OrderedPair.

    Returns
    -------
    TypedDict:
        x: Vector from input x
        y: Vector from input y
    """

    return ResultSplit(x=Vector(v=default.x), y=Vector(v=default.y))

Find this Flojoy Block on GitHub

Example App

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

This example shows the function of the ORDERED_PAIR_2_VECTOR node. It changes an Ordered Pair into a Vector. Specifcally, the x axis is removed and the y axis is used as the vector.