Skip to content

Generating wires from an imported float array. #35

Discussion options

You must be logged in to vote

Welcome there @tim-rastall-reveal !
Thanks for your thanks ;)
A question is only trivial when you already know the answer

Step by step

I will suppose that you have an array of float64, else you should first convert it.

sourcepoints = np.empty((n,3), dtype='f8')
# if it's comming in a different number type, do the following
sourcepoints = mysource.astype('f8')

Once you have it, you can cast it into an array of vec3, so madcad will know that it is points, not just a matrix. That operation won't copy anything, this is just a type reinterpretation.

points = typedlist(sourcepoints, dtype=vec3)

Note that creating a typedlist in that way doesn't check for the input type, so it can be error-prone…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@tim-rastall-reveal
Comment options

@jimy-byerley
Comment options

@jimy-byerley
Comment options

@jimy-byerley
Comment options

Answer selected by jimy-byerley
Comment options

You must be logged in to vote
2 replies
@jimy-byerley
Comment options

@jimy-byerley
Comment options

Comment options

You must be logged in to vote
2 replies
@jimy-byerley
Comment options

@Yarkane
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants