Last active
November 30, 2017 18:21
-
-
Save jrwells/3669e151b04803e6c51405be2926e381 to your computer and use it in GitHub Desktop.
Binding basic2d functionality in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import basic2d | |
proc scale*(m: ref Matrix2d, s: cdouble): ref Matrix2d {.cdecl, exportc, noinit.} = | |
m[] = scale(s) | |
return m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import * | |
class Matrix2d(Structure): | |
_fields_ = [('ax', c_double), | |
('ay', c_double), | |
('bx', c_double), | |
('by', c_double), | |
('tx', c_double), | |
('ty', c_double)] | |
binding = CDLL('binding') | |
scale = binding.scale | |
scale.argtypes = [ c_double ] | |
scale.restype = Matrix2d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment