Skip to content

knuckleheaded code in bsptree.cc #184

@m-7761

Description

@m-7761

https://github.com/zturtleman/mm3d/blob/53b0d1b33412bddacd65559f41d5511b9050a27a/src/libmm3d/bsptree.cc#L127-L188

You can see this is doing some form of iterative search. Below is equivalent code. Note, "abc" and "d" are the normal and plane-distance for that node. And below that I went ahead and uploaded the results of a cleanup pass I did last night. I will say it seems to do double-duty by allocating the Node and Poly objects separately when in fact they're the same objects.

double BspTree::Poly::intersection(double *p1, double *p2, double *po)
{
	double *abc = norm(), p2_p1[3];

	for(int i=3;i-->0;) p2_p1[i] = p2[i]-p1[i];

	double t = (d-dot_product(abc,p1))/dot_product(abc,p2_p1);

	lerp3(po,p1,p2,t); return t;
}

https://github.com/mick-p1982/mm3d/blob/widgets95-ui/src/libmm3d/bsptree.cc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions