last day (156 days later) » 

4:53 PM
hi
 
5:40 PM
hi
 
 
1 hour later…
6:41 PM
?
who's alive ?
 
im alive
 
so we are here to discuss about WPF
 
so the chat name says.
 
@JMcCarty can u help me in solving this method, i'm not very good at geometry
 
hmm...I can try
 
6:52 PM
Function GetBoundingRectangle(ByRef Items As IEnumerable(Of UiElement)) As Rect
Dim x1 As Double = [Double].MaxValue
Dim y1 As Double = [Double].MaxValue
Dim x2 As Double = [Double].MinValue
Dim y2 As Double = [Double].MinValue

For Each Item As UiElement In Items

Dim bounds As Rect = Item.TransformToAncestor(CType(VisualTreeHelper.GetParent(Item), Visual)).TransformBounds(VisualTreeHelper.GetDescendantBounds(Item))

x1 = Math.Min(bounds.X, x1)
y1 = Math.Min(bounds.Y, y1)

x2 = Math.Max(bounds.Width + bounds.X, x2)
@Jmccarty i want the alternate if, there were no parent for item.
@JMcCarty ?
 
im not sure what your looking for exactly
 
@JMcCarty i'm looking for a method to calculate a boundinbox ... stackoverflow.com/questions/6115710/…
 
ah ok, yes i can help you with that. I actually have a custom canvas that does that to calculate it's size
 
@JMcCarty Ok.... So...
 
give me 1 moment
 
7:00 PM
@JMcCarty ok
 
wait, does the code you posted work for items that are not skewed?
 
@JMcCarty I've tested only with rotatetransform applied. I going to check.
@JMcCarty It works for all conditions ... rotated/not rotated ... skewed/not skewed
 
so isn't that what you were looking for?
 
@JMcCarty It is, but i'm looking for code, if there were no parent, the items were not child of any control. It uses VisualTreeHelper.GetParent , which i don't want
 
oh ok
 
7:09 PM
@JMcCarty Can u help ?
 
if these objects are in a window/page/layout object then they will have a visual parent. Or are you trying to get the code for generic terms so you can apply it to none WPF controls?
 
@JMcCarty I don't know much WPF, its my starting. I want code before they are child of any control.
?
 
@Neeraj Why are you doing the calc prior to making them a child control? To see if it will fit? If its just to size the control then just add them and do it afterward (override the onMeasure method)
 
@JMcCarty The app is something like that.
It's not only to size the control but to align it also
Based on transforms present in item
 
@Neeraj Ok, so you would like the bounding rectangle with as little extra space as possible. so if your objects were skewed at 90 degrees, your bounding box would be too?
 
7:21 PM
@JMcCarty Ok, but i need solution
 
im just makign sure i understand what you want
 
@JMcCarty Wait.... See i'm simply making image editing app, the items can't skew box, but box can skew items. If you have any image editing app, open it , put two rects (with rotate, skew), then group them. This is what i want.
@JMcCarty I must had told this earlier, sorry for that
?
 
@Neeraj hmm...GIMP won't allow me to do that, i can edit things but cannot make persistant objects
 
I'm using Adobe's Fireworks
@JMcCarty Are u linux ?
Or Window Version of GIMP ?
 
@Neeraj Windows version
 
7:33 PM
Any other editor d u have ?
 
nope just paint
 
@JMcCarty Paint is Paint ...
 
MSPaint
 
@JMcCarty Have u got what i want ?
 
Looks like i do not, I could brute force the math thought
 
7:36 PM
I have XY values, Rotation Angle , Width, Height of every item.
I just want to calculte the Width, Height of Green Rect in image
If there were no parent of item
 
if you have all that then the code you have before is fine, just leave out the Parent transform
since all that is doing is putting them in the same coordinate plane
if your cooridantes are already in the same plain then the math works
*plane
do you have the xy coordinates for all points of the rectangle?
if you have only the coordinate for one corner of the object, prior to being skewed then use the matrix calc found en.wikipedia.org/wiki/Rotation_(mathematics) there to get the new coordinates
that forumla and the code you had before are all you need
 

  last day (156 days later) »