Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct inaccurate coloring of Radia objects. #10

Open
dtabell opened this issue May 30, 2020 · 1 comment
Open

Correct inaccurate coloring of Radia objects. #10

dtabell opened this issue May 30, 2020 · 1 comment

Comments

@dtabell
Copy link
Contributor

dtabell commented May 30, 2020

Assign a specific [R, G, B] color to a Radia object, as in

rad.ObjDrwAtr(mag, [1.0, 0.5, 0.0])

Then render the object in the Radia Viewer. Fractional values appear
to be truncated to zero. The above example renders as pure red, rather
than orange.

(This might actually be an issue for Radia itself, but I recording here for now.)

@mkeilman
Copy link
Contributor

mkeilman commented Jun 2, 2020

I looked at the color array we get back from ObjDrwVTK and it is incorrect. The float values are cast to long (there's even an inquisitive comment about it in radpy.cpp.ParseGeomDataDrwVTK()):

	for(Py_ssize_t i = PyList_Size(colors); --i >= 0;) 
	{
		PyObject *o = PyLong_FromDouble(arColP[i]); //why colors are float at input if they are casted to long here?
		if(o == NULL || PyList_SetItem(colors, i, o) < 0) throw strEr_MAF;
	}

I guess that's the culprit here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants