OCP icon indicating copy to clipboard operation
OCP copied to clipboard

How to update math_Matrix

Open mnesarco opened this issue 2 years ago • 1 comments
trafficstars

Hi Friends, I need to use math_Matrix in an algorithm in python, but the c++ object is updated using non const references returned by auto operator(int, int) -> double&.

In C++:

void something(math_Matrix& m) {
  m(1,5) = 0.5;
}

In python this has no sense:

from OCP.math import math_Matrix

def something(m: math_Matrix):
  m(1,5) = 0.5

Same problem with math_Vector

I appreciate any advice.

Thanks.

mnesarco avatar Sep 08 '23 14:09 mnesarco

Not ideal, but try m.Set(i,i,j,j, OCP.math.math_Matrix(1,1,1,1, value)).

adam-urbanczyk avatar Sep 08 '23 21:09 adam-urbanczyk