Calculate edge "profiles"?
-
Being curious I decided try write my own method that would return edges that would be higlighted by SU "profiles" that are found in edge style settings. Here's screanshot of what I mean:
![Dark lines are edge "profiles"](/uploads/imported_attachments/7I2e_Untitled.png "Dark lines are edge "profiles"")
I've tried to figure out how to get the profile edges myself, but don't plan to get my brain into enormous thinking tension; it's just hard and too complicated!!! What I know is that to figure out what edges need to be highlighted there should be a known camera transformation (in this case only one point perspective cam) and current position of face edges (relative to real origin). By the way, If you know whats the real name for that edge "profiles" is called, please don't hide to tell, cause I've already searched the internet on "edge profiles", and got none of wanted. -
Here's a possible simplistic 'algorithm'...
[Untested!]
Find all of the available edges [in an array].
Iterate through them and process each edge in turn.
Get the vector from the edge.start.position to the model.active_view.camera.
Get the edge.faces
If there's not edge.faces[1] then the edge is 'in profile'.
Otherwise process each of the edge.faces [assume there's two].
Test the face.normal.angle_between(vector)>=90.degrees for both of them
If one >90 then that face is not looking at the camera, therefore the edge is 'in profile'.
If neither OR both are <90 then the edge is not 'in profile'.
Do what it is you need to do to the edges that are profiles.
You need some tricks to trap for edges partially obscured by other objects etc... that's stage 2
Remember that if they are inside groups/instances then the points/vectors etc will need to be transformed to suit the container's transformation..... -
TIG, your profetional!
Everything works, the way you said
[attachment=1:ylsl8vni]<!-- ia1 -->SelectEdgesInProfiles.png<!-- ia1 -->[/attachment:ylsl8vni]
Here's a little plug I've got for a little testing.
[attachment=0:ylsl8vni]<!-- ia0 -->SelectEdgesInProfiles.rb<!-- ia0 -->[/attachment:ylsl8vni]
%(#00BF00)[Select Edges in Profiles
Date - Monday, July 16, 2012
Version 1.0.1
Main thing on how to locate the edges in profiles is by TIG
Written by Anton Synytsia
Not a plugin, but written for simple use of testingMenu Location: UI_menu:plugins/selectEdgesInProfiles
Usage: Select grp(s) or/and component instance(s) and then select the menu item
Yet, Unsolved bugs:
- Selects edges that camera doesn't sees.
- TIG.getEdges function doesn't yet search the group for edges found inside the parent group.]
Changes: Fixed the selection of edges behind the faces, the edges that camera doesn't even sees.
Advertisement