When shall one write a mathematical expression as a separate line in a paper/Ph.D. thesis? When do we write a mathematical expression on a separate line, and when do we write it inline with the text?

I believe that the answer is the same for researching papers and Ph.D. theses, or maybe even textbooks; but please correct me if I am wrong.

Here I am referring to a paper/thesis on mathematics. When one writes a mathematical paper, sometimes one writes a mathematical expression in a separate line such as in the following example:


  We know that the identity
  a2+b2=c2
  holds true if ....


While sometimes one writes the mathematical expression inline with the text, such as in the following example:


  Let f:X->Y be a one-to-one map, ...


My impression is the longer the expression is, the more likely it is written in a separate line. But is there any (possibly unwritten) rule for it?
In the areas in which I work, there are no formal rules and it is left up to the author when to separate an equation and when to embed it in the text.  When I am writing, I find that there are three fairly straightforward principles that work well for me in determining whether an equation (or other mathematical statement) deserves its own line or can be inline with the text:


Will I need to refer to the equation elsewhere?  If so, it needs its own line, and equation numbering as well.
Is it more than ~1/3 of a line long?  Anything so long that it is likely to get broken across lines and otherwise be a typographical mess should be pulled out onto its own line.  Numbering is not required.
Do I want the reader to "pause" and contemplate the equation, or do I want it to "flow" as part of the sentence encompassing it?


This last needs a little bit more explanation... let's elaborate on one of the examples from the original question.  If I write the sentence this way:


  We know that the identity a^2+b^2=c^2 holds true if the system is in condition X.


then the equation should be inline, because the sentence is really about condition X, rather than about the equation.  If, on the other hand, the reader's attention should be directed to the equation, then it is better to use something like the following form, with the equation on its own line:


  We know that if the system is in condition X, then the following identity holds:
  
  
    a^2+b^2=c^2
  


Note: these principles reduce to a similar effect as the style guide given by @silvado