MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Is it possible to create custom drawing procedure for my object?

Is it possible to define a custom draw procedure for some custom
object? For example, I have some figure, which is defined by two


How to do so that this figure will draw like normal Line or Circle


I don't want to define FigureOfMyOwn as a function, which converts to
construction of Lines and Circles, I want it behaves like Circle, i.e.
remain unchanged if used in formulas. Only drawing procedure should be

I.e. is it possible to do something correct like this:

Graphics[x_FigureOfMyOwn] := Graphics[Circle[x[[1]], Norm[x[[2]] -


The approach above doesn't work correctly since it draws

Graphics[FigureOfMyOwn[{0, 0}, {1, 1}]]

but not draws

Graphics[{Line[{{0, 0}, {1, 1}}], FigureOfMyOwn[{0, 0}, {1, 1}]}]

while draws

Graphics[{Line[{{0, 0}, {1, 1}}], Circle[{0, 0}, Sqrt[2]]}]


  • Prev by Date: Re: Simplifying to PolyLog
  • Next by Date: question on passing variable to function by reference
  • Previous by thread: Re: Using the fonts available in the Format>Font menu as part of Style[]?
  • Next by thread: question on passing variable to function by reference