Skip to content

numpy cheats #8

@zeffii

Description

@zeffii

convert an array of 2d vectors to 3d vectors.
see: https://stackoverflow.com/questions/36878089/python-add-a-column-to-numpy-2d-array

import numpy as np
array_2dvec = np.array([ [x1, y1], [x2, y2], [x3, y3] ])
array_3dvec = np.hstack( (array_2dvec, np.zeros((len(array_2dvec), 1)) ))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions